diff --git a/submissions/forms.py b/submissions/forms.py
index e299e58cd601c661b44c9bcd3adb8148729ed554..43e02014b2217cacd32a5ff3c408a788c0dcd618 100644
--- a/submissions/forms.py
+++ b/submissions/forms.py
@@ -1,6 +1,6 @@
 from django import forms
 from django.core.validators import RegexValidator
-#from django.contrib.auth.models import User, Group
+# from django.contrib.auth.models import User, Group
 
 from .models import *
 
@@ -37,7 +37,6 @@ class SubmissionIdentifierForm(forms.Form):
         ])
 
 
-
 class SubmissionForm(forms.ModelForm):
     class Meta:
         model = Submission
@@ -73,8 +72,10 @@ class SubmissionForm(forms.ModelForm):
             'placeholder': 'Optional: names of suggested referees',
             'rows': 3})
         self.fields['referees_flagged'].widget.attrs.update({
-                'placeholder': 'Optional: names of referees whose reports should be treated with caution (+ short reason)',
-                'rows': 3})
+            'placeholder': 'Optional: names of referees whose reports should be treated with caution (+ short reason)',
+            'rows': 3})
+
+
 
 
 ######################
@@ -85,12 +86,10 @@ class AssignSubmissionForm(forms.Form):
 
     def __init__(self, *args, **kwargs):
         discipline = kwargs.pop('discipline')
-#        subject_area = kwargs.pop('subject_area') # Reactivate later on, once the Editorial College is large enough
-        super(AssignSubmissionForm,self).__init__(*args, **kwargs)
+        super(AssignSubmissionForm, self).__init__(*args, **kwargs)
         self.fields['editor_in_charge'] = forms.ModelChoiceField(
             queryset=Contributor.objects.filter(user__groups__name='Editorial College',
                                                 user__contributor__discipline=discipline,
-#                                                user__contributor__expertises__contains=[subject_area,] # Reactivate later on, once the Editorial College is large enough
                                                 ).order_by('user__last_name'),
             required=True, label='Select an Editor-in-charge')
 
@@ -125,7 +124,7 @@ class RefereeRecruitmentForm(forms.ModelForm):
                 Field('email_address'),
                 Submit('submit', 'Send invitation', css_class="submitButton"),
                 css_class="flex-whitebox320")
-            )
+        )
 
 
 class ConsiderRefereeInvitationForm(forms.Form):
@@ -138,19 +137,20 @@ class SetRefereeingDeadlineForm(forms.Form):
     deadline = forms.DateField(required=False, label='',
                                widget=forms.SelectDateWidget)
 
+
 class VotingEligibilityForm(forms.Form):
 
     def __init__(self, *args, **kwargs):
         discipline = kwargs.pop('discipline')
         subject_area = kwargs.pop('subject_area')
-        super(VotingEligibilityForm,self).__init__(*args, **kwargs)
+        super(VotingEligibilityForm, self).__init__(*args, **kwargs)
         self.fields['eligible_Fellows'] = forms.ModelMultipleChoiceField(
             queryset=Contributor.objects.filter(
                 user__groups__name__in=['Editorial College'],
                 user__contributor__discipline=discipline,
                 user__contributor__expertises__contains=[subject_area]
             ).order_by('user__last_name'),
-            widget = forms.CheckboxSelectMultiple({'checked': 'checked'}),
+            widget=forms.CheckboxSelectMultiple({'checked': 'checked'}),
             required=True, label='Eligible for voting',
         )
 
@@ -159,10 +159,10 @@ class VotingEligibilityForm(forms.Form):
 ############
 
 REPORT_ACTION_CHOICES = (
-#    (0, 'modify'),
+    #    (0, 'modify'),
     (1, 'accept'),
     (2, 'refuse'),
-    )
+)
 
 REPORT_REFUSAL_CHOICES = (
     (0, '-'),
@@ -170,8 +170,9 @@ REPORT_REFUSAL_CHOICES = (
     (-2, 'not fully factually correct'),
     (-3, 'not useful for the authors'),
     (-4, 'not sufficiently academic in style'),
-    )
-report_refusal_choices_dict=dict(REPORT_REFUSAL_CHOICES)
+)
+
+report_refusal_choices_dict = dict(REPORT_REFUSAL_CHOICES)
 
 
 class ReportForm(forms.ModelForm):
@@ -180,6 +181,7 @@ class ReportForm(forms.ModelForm):
         fields = ['qualification', 'strengths', 'weaknesses', 'report', 'requested_changes',
                   'validity', 'significance', 'originality', 'clarity', 'formatting', 'grammar',
                   'recommendation', 'remarks_for_editors', 'anonymous']
+
     def __init__(self, *args, **kwargs):
         super(ReportForm, self).__init__(*args, **kwargs)
         self.fields['strengths'].widget.attrs.update(
@@ -223,7 +225,6 @@ class EditorialCommunicationForm(forms.Form):
             {'rows': 5, 'cols': 50, 'placeholder': 'Write your message in this box.'})
 
 
-
 ######################
 # EIC Recommendation #
 ######################
@@ -234,6 +235,7 @@ class EICRecommendationForm(forms.ModelForm):
         fields = ['recommendation',
                   'remarks_for_authors', 'requested_changes',
                   'remarks_for_editorial_college']
+
     def __init__(self, *args, **kwargs):
         super(EICRecommendationForm, self).__init__(*args, **kwargs)
         self.fields['remarks_for_authors'].widget.attrs.update(
@@ -256,7 +258,7 @@ class RecommendationVoteForm(forms.Form):
                                       ('disagree', 'Disagree'),
                                       ('abstain', 'Abstain')],
                              label='',
-                         )
+                             )
     remark = forms.CharField(widget=forms.Textarea(), label='', required=False)
 
     def __init__(self, *args, **kwargs):
diff --git a/submissions/models.py b/submissions/models.py
index fcb9237ac75aaa5288a37e888f93a2d3267af517..b98ade4c96f582b19f060a43126bc62df7224430 100644
--- a/submissions/models.py
+++ b/submissions/models.py
@@ -1,6 +1,8 @@
+import datetime
+
 from django.utils import timezone
 from django.utils.safestring import mark_safe
-from django.db import models
+from django.db import models, transaction
 from django.contrib.auth.models import User
 from django.contrib.postgres.fields import ArrayField, JSONField
 from django.template import Template, Context
@@ -102,33 +104,33 @@ submission_type_dict = dict(SUBMISSION_TYPE)
 
 class Submission(models.Model):
     # Main submission fields
-    is_current = models.BooleanField(default=True)
-    is_resubmission = models.BooleanField(default=False)
-    submitted_by = models.ForeignKey(Contributor, on_delete=models.CASCADE)
-    editor_in_charge = models.ForeignKey(Contributor, related_name='EIC', blank=True, null=True,
-                                         on_delete=models.CASCADE)
-    submitted_to_journal = models.CharField(max_length=30, choices=SCIPOST_JOURNALS_SUBMIT,
-                                            verbose_name="Journal to be submitted to")
-    submission_type = models.CharField(max_length=10, choices=SUBMISSION_TYPE,
-                                       blank=True, null=True, default=None)
+    author_comments = models.TextField(blank=True, null=True)
+    author_list = models.CharField(max_length=1000, verbose_name="author list")
     discipline = models.CharField(max_length=20, choices=SCIPOST_DISCIPLINES, default='physics')
     domain = models.CharField(max_length=3, choices=SCIPOST_JOURNALS_DOMAINS)
-    subject_area = models.CharField(max_length=10, choices=SCIPOST_SUBJECT_AREAS,
-                                    verbose_name='Primary subject area', default='Phys:QP')
-    secondary_areas = ChoiceArrayField(
-        models.CharField(max_length=10, choices=SCIPOST_SUBJECT_AREAS),
-        blank=True, null=True)
-    status = models.CharField(max_length=30, choices=SUBMISSION_STATUS)  # set by Editors
-    author_comments = models.TextField(blank=True, null=True)
+    editor_in_charge = models.ForeignKey(Contributor, related_name='EIC', blank=True, null=True,
+                                         on_delete=models.CASCADE)
+    is_current = models.BooleanField(default=True)
+    is_resubmission = models.BooleanField(default=False)
     list_of_changes = models.TextField(blank=True, null=True)
-    remarks_for_editors = models.TextField(blank=True, null=True)
-    referees_suggested = models.TextField(blank=True, null=True)
-    referees_flagged = models.TextField(blank=True, null=True)
+    open_for_commenting = models.BooleanField(default=False)
     open_for_reporting = models.BooleanField(default=False)
+    referees_flagged = models.TextField(blank=True, null=True)
+    referees_suggested = models.TextField(blank=True, null=True)
+    remarks_for_editors = models.TextField(blank=True, null=True)
     reporting_deadline = models.DateTimeField(default=timezone.now)
-    open_for_commenting = models.BooleanField(default=False)
+    secondary_areas = ChoiceArrayField(
+        models.CharField(max_length=10, choices=SCIPOST_SUBJECT_AREAS),
+        blank=True, null=True)
+    status = models.CharField(max_length=30, choices=SUBMISSION_STATUS, default='unassigned')  # set by Editors
+    subject_area = models.CharField(max_length=10, choices=SCIPOST_SUBJECT_AREAS,
+                                    verbose_name='Primary subject area', default='Phys:QP')
+    submission_type = models.CharField(max_length=10, choices=SUBMISSION_TYPE,
+                                       blank=True, null=True, default=None)
+    submitted_by = models.ForeignKey(Contributor, on_delete=models.CASCADE)
+    submitted_to_journal = models.CharField(max_length=30, choices=SCIPOST_JOURNALS_SUBMIT,
+                                            verbose_name="Journal to be submitted to")
     title = models.CharField(max_length=300)
-    author_list = models.CharField(max_length=1000, verbose_name="author list")
 
     # Authors which have been mapped to contributors:
     authors = models.ManyToManyField(Contributor, blank=True, related_name='authors_sub')
@@ -146,7 +148,7 @@ class Submission(models.Model):
 
     # Metadata
     metadata = JSONField(default={}, blank=True, null=True)
-    submission_date = models.DateField(verbose_name='submission date')
+    submission_date = models.DateField(verbose_name='submission date', default=timezone.now)
     latest_activity = models.DateTimeField(default=timezone.now)
 
     class Meta:
@@ -173,8 +175,64 @@ class Submission(models.Model):
             return True
         return False
 
-
-    def header_as_table (self):
+    @transaction.atomic
+    def finish_submission(self):
+        if self.is_resubmission:
+            self.mark_other_versions_as_deprecated()
+            self.copy_authors_from_previous_version()
+            self.copy_EIC_from_previous_version()
+            self.set_resubmission_defaults()
+        else:
+            self.authors.add(self.submitted_by)
+
+        self.save()
+
+    def make_assignment(self):
+        assignment = EditorialAssignment(
+            submission=self,
+            to=self.editor_in_charge,
+            accepted=True,
+            date_created=timezone.now(),
+            date_answered=timezone.now(),
+        )
+        assignment.save()
+
+    def set_resubmission_defaults(self):
+        self.open_for_reporting = True
+        self.open_for_commenting = True
+        if self.other_versions()[0].submitted_to_journal == 'SciPost Physics Lecture Notes':
+            self.reporting_deadline = timezone.now() + datetime.timedelta(days=56)
+        else:
+            self.reporting_deadline = timezone.now() + datetime.timedelta(days=28)
+
+    def copy_EIC_from_previous_version(self):
+        last_version = self.other_versions()[0]
+        self.editor_in_charge = last_version.editor_in_charge
+        self.status = 'EICassigned'
+
+    def copy_authors_from_previous_version(self):
+        last_version = self.other_versions()[0]
+
+        for author in last_version.authors.all():
+            self.authors.add(author)
+        for author in last_version.authors_claims.all():
+            self.authors_claims.add(author)
+        for author in last_version.authors_false_claims.all():
+            self.authors_false_claims.add(author)
+
+    def mark_other_versions_as_deprecated(self):
+        for sub in self.other_versions():
+            sub.is_current = False
+            sub.open_for_reporting = False
+            sub.status = 'resubmitted'
+            sub.save()
+
+    def other_versions(self):
+        return Submission.objects.filter(
+            arxiv_identifier_wo_vn_nr=self.arxiv_identifier_wo_vn_nr
+        ).exclude(pk=self.id).order_by('-arxiv_vn_nr')
+
+    def header_as_table(self):
         # for Submission page
         header = '<table>'
         header += '<tr><td>Title: </td><td>&nbsp;</td><td>{{ title }}</td></tr>'
diff --git a/submissions/services.py b/submissions/services.py
index bd16fb2ae70960507034ca3e46f8b6780a85fe87..671a4326173d084fef01f656d625deb7ecfd4218 100644
--- a/submissions/services.py
+++ b/submissions/services.py
@@ -1,67 +1,130 @@
 # Module for making external api calls as needed in the submissions cycle
 import feedparser
+import requests
+import pprint
+import re
+from io import BytesIO
 
-from .models import *
+from .models import Submission
 
 
 class ArxivCaller():
-    def lookup_article(identifier):
-        # Pre-checks
-        if same_version_exists(identifier)
-            return False, "This preprint version has already been submitted to SciPost."
+    """ Performs an Arxiv article lookup for given identifier """
+
+    # State of the caller
+    isvalid = None
+    errorcode = ''
+    resubmission = False
+    previous_submissions = []
+    arxiv_journal_ref = ''
+    arxiv_doi = ''
+    metadata = {}
+    query_base_url = 'http://export.arxiv.org/api/query?id_list=%s'
+    identifier_without_vn_nr = ''
+    identifier_with_vn_nr = ''
+    version_nr = None
+
+    def __init__(self):
+        pass
+
+    def is_valid(self):
+        if self.isvalid is None:
+            print("Run process() first")
+            return False
+        return self.isvalid
+
+    def process(self, identifier):
+        # ============================= #
+        # Pre-checks                    #
+        # ============================= #
+        if self.same_version_exists(identifier):
+            self.errorcode = 'preprint_already_submitted'
+            self.isvalid = False
+            return
 
         # Split the given identifier in an article identifier and version number
-        identifier_without_vn_nr = identifier.rpartition('v')[0]
-        arxiv_vn_nr = int(identifier.rpartition('v')[2])
-
-        resubmission = False
-        if previous_submission_undergoing_refereeing(identifier):
-            errormessage = '<p>There exists a preprint with this arXiv identifier '
-                            'but an earlier version number, which is still undergoing '
-                            'peer refereeing.</p>'
-                            '<p>A resubmission can only be performed after request '
-                            'from the Editor-in-charge. Please wait until the '
-                            'closing of the previous refereeing round and '
-                            'formulation of the Editorial Recommendation '
-                            'before proceeding with a resubmission.</p>'
-            return False, errormessage
-
-        # Arxiv query
-        queryurl = ('http://export.arxiv.org/api/query?id_list=%s'
-                    % identifier)
-        arxiv_response = feedparser.parse(queryurl)
+        if re.match("^[0-9]{4,}.[0-9]{4,5}v[0-9]{1,2}$", identifier) is None:
+            self.errorcode = 'bad_identifier'
+            self.isvalid = False
+            return
+
+        self.identifier_without_vn_nr = identifier.rpartition('v')[0]
+        self.identifier_with_vn_nr = identifier
+        self.version_nr = int(identifier.rpartition('v')[2])
+
+        previous_submissions = self.different_versions(self.identifier_without_vn_nr)
+        if previous_submissions:
+            if previous_submissions[0].status == 'revision_requested':
+                self.resubmission = True
+                self.previous_submissions = previous_submissions
+            elif previous_submissions[0].status in ['rejected', 'rejected_visible']:
+                self.errorcode = 'previous_submissions_rejected'
+                self.isvalid = False
+                return
+            else:
+                self.errorcode = 'previous_submission_undergoing_refereeing'
+                self.isvalid = False
+                return
+
+        # ============================= #
+        # Arxiv query                   #
+        # ============================= #
+        queryurl = (self.query_base_url % identifier)
+
+        try:
+            req = requests.get(queryurl, timeout=4.0)
+        except requests.ReadTimeout:
+            self.errorcode = 'arxiv_timeout'
+            self.isvalid = False
+            return
+        except requests.ConnectionError:
+            self.errorcode = 'arxiv_timeout'
+            self.isvalid = False
+            return
+
+        content = req.content
+        arxiv_response = feedparser.parse(content)
 
         # Check if response has at least one entry
-        if not 'entries' in arxiv_response
-            errormessage = 'Bad response from Arxiv.'
-            return False, errormessage
+        if req.status_code == 400 or 'entries' not in arxiv_response:
+            self.errorcode = 'arxiv_bad_request'
+            self.isvalid = False
+            return
+
+        # arxiv_response['entries'][0]['title'] == 'Error'
 
         # Check if preprint exists
-        if not preprint_exists(arxiv_response)
-            errormessage = 'A preprint associated to this identifier does not exist.'
-            return False, errormessage
+        if not self.preprint_exists(arxiv_response):
+            self.errorcode = 'preprint_does_not_exist'
+            self.isvalid = False
+            return
 
         # Check via journal ref if already published
-        arxiv_journal_ref = published_journal_ref
-        if arxiv_journal_ref
-            errormessage = 'This paper has been published as ' + arxiv_journal_ref +
-                            '. You cannot submit it to SciPost anymore.'
-            return False, resubmission
+        self.arxiv_journal_ref = self.published_journal_ref(arxiv_response)
+        if self.arxiv_journal_ref:
+            self.errorcode = 'paper_published_journal_ref'
+            self.isvalid = False
+            return
 
         # Check via DOI if already published
-        arxiv_doi = published_journal_ref
-        if arxiv_doi
-            errormessage = 'This paper has been published under DOI ' + arxiv_doi
-                            + '. You cannot submit it to SciPost anymore.'
-            return False, errormessage
-
-        return arxiv_response, ""
+        self.arxiv_doi = self.published_doi(arxiv_response)
+        if self.arxiv_doi:
+            self.errorcode = 'paper_published_doi'
+            self.isvalid = False
+            return
 
+        self.metadata = arxiv_response
+        self.isvalid = True
+        return
 
-    def same_version_exists(identifier):
+    def same_version_exists(self, identifier):
         return Submission.objects.filter(arxiv_identifier_w_vn_nr=identifier).exists()
 
-    def previous_submission_undergoing_refereeing(identifier):
+    def different_versions(self, identifier):
+        return Submission.objects.filter(
+            arxiv_identifier_wo_vn_nr=identifier).order_by('-arxiv_vn_nr')
+
+    def check_previous_submissions(self, identifier):
         previous_submissions = Submission.objects.filter(
             arxiv_identifier_wo_vn_nr=identifier).order_by('-arxiv_vn_nr')
 
@@ -70,17 +133,17 @@ class ArxivCaller():
         else:
             return False
 
-    def preprint_exists(arxiv_response):
+    def preprint_exists(self, arxiv_response):
         return 'title' in arxiv_response['entries'][0]
 
-    def published_journal_ref(arxiv_response):
-        if 'arxiv_journal_ref' in arxiv_response['entries'][0]
+    def published_journal_ref(self, arxiv_response):
+        if 'arxiv_journal_ref' in arxiv_response['entries'][0]:
             return arxiv_response['entries'][0]['arxiv_journal_ref']
         else:
             return False
 
-    def published_DOI(arxiv_response):
-        if 'arxiv_doi' in arxiv_response['entries'][0]
+    def published_doi(self, arxiv_response):
+        if 'arxiv_doi' in arxiv_response['entries'][0]:
             return arxiv_response['entries'][0]['arxiv_doi']
         else:
             return False
diff --git a/submissions/templates/submissions/new_submission.html b/submissions/templates/submissions/new_submission.html
new file mode 100644
index 0000000000000000000000000000000000000000..71fb9dcc12c2ea218e0749b1d1b2c3e578da911b
--- /dev/null
+++ b/submissions/templates/submissions/new_submission.html
@@ -0,0 +1,85 @@
+{% extends 'scipost/base.html' %}
+
+{% block pagetitle %}: submit manuscript{% endblock pagetitle %}
+
+{% block bodysup %}
+
+
+<script>
+$(document).ready(function(){
+  $("#id_submission_type").closest('tr').hide()
+
+  $('select#id_submitted_to_journal').on('change', function (){
+  var selection = $(this).val();
+  switch(selection){
+    case "SciPost Physics":
+      $("#id_submission_type").closest('tr').show()
+      break;
+    default:
+      $("#id_submission_type").closest('tr').hide()
+  }
+});
+
+  var isresub = $("#id_is_resubmission").val();
+  switch(isresub){
+    case "True":
+      $("#id_author_comments").closest('tr').show()
+      $("#id_list_of_changes").closest('tr').show()
+      break;
+    default:
+      $("#id_author_comments").closest('tr').hide()
+      $("#id_list_of_changes").closest('tr').hide()
+  }
+
+});
+</script>
+
+<section>
+  <div class="flex-greybox">
+    <h1>Submit a manuscript to SciPost</h1>
+  </div>
+
+  <p>Before submitting, make sure you agree with the
+    <a href="{% url 'journals:journals_terms_and_conditions' %}">
+      SciPost Journals Terms and Conditions</a>.</p>
+  <p>You should also make sure you understand the
+    <a href="{% url 'submissions:sub_and_ref_procedure' %}#pwr">
+      refereeing procedure</a> and its open aspect.</p>
+  <p>In particular, make sure you are familiar with the
+    <a href="{% url 'journals:journals_terms_and_conditions' %}#license_and_copyright_agreement">
+      license and copyright agreement</a>
+    and the <a href="{% url 'journals:journals_terms_and_conditions' %}#author_obligations">
+      author obligations</a>.</p>
+  <p>Please prepare your manuscript according to the
+    <a href="{% url 'submissions:author_guidelines' %}">author guidelines</a>.</p>
+
+
+  {% if perms.scipost.can_submit_manuscript %}
+
+  {% if form.arxiv_link.value %}
+  <form id="full_submission_form" action="{% url 'submissions:submit_manuscript' %}" method="post">
+    {% csrf_token %}
+    <table>
+      <ul>
+	{{ form.as_table }}
+      </ul>
+    </table>
+    <p>By clicking on Submit, you state that you have read and agree with
+      the <a href="{% url 'journals:journals_terms_and_conditions' %}">
+	SciPost Journals Terms and Conditions</a>, the
+      <a href="{% url 'journals:journals_terms_and_conditions' %}#license_and_copyright_agreement">
+	license and copyright agreement</a>
+      and the <a href="{% url 'journals:journals_terms_and_conditions' %}#author_obligations">
+	author obligations</a>.</p>
+    <input type="submit" value="Submit"/>
+  </form>
+  {% endif %}
+
+  {% else %}
+  <h3>You are currently not allowed to submit a manuscript.</h3>
+  {% endif %}
+
+</section>
+
+
+{% endblock bodysup %}
diff --git a/submissions/templates/submissions/prefill_using_identifier.html b/submissions/templates/submissions/prefill_using_identifier.html
new file mode 100644
index 0000000000000000000000000000000000000000..41f3dd90c645969b1b5752d8c4166a787f00c905
--- /dev/null
+++ b/submissions/templates/submissions/prefill_using_identifier.html
@@ -0,0 +1,86 @@
+{% extends 'scipost/base.html' %}
+
+{% block pagetitle %}: submit manuscript{% endblock pagetitle %}
+
+{% block bodysup %}
+
+
+<script>
+$(document).ready(function(){
+  $("#id_submission_type").closest('tr').hide()
+
+  $('select#id_submitted_to_journal').on('change', function (){
+  var selection = $(this).val();
+  switch(selection){
+    case "SciPost Physics":
+      $("#id_submission_type").closest('tr').show()
+      break;
+    default:
+      $("#id_submission_type").closest('tr').hide()
+  }
+});
+
+  var isresub = $("#id_is_resubmission").val();
+  switch(isresub){
+    case "True":
+      $("#id_author_comments").closest('tr').show()
+      $("#id_list_of_changes").closest('tr').show()
+      break;
+    default:
+      $("#id_author_comments").closest('tr').hide()
+      $("#id_list_of_changes").closest('tr').hide()
+  }
+
+});
+</script>
+
+<section>
+  <div class="flex-greybox">
+    <h1>Submit a manuscript to SciPost</h1>
+  </div>
+
+  <p>Before submitting, make sure you agree with the
+    <a href="{% url 'journals:journals_terms_and_conditions' %}">
+      SciPost Journals Terms and Conditions</a>.</p>
+  <p>You should also make sure you understand the
+    <a href="{% url 'submissions:sub_and_ref_procedure' %}#pwr">
+      refereeing procedure</a> and its open aspect.</p>
+  <p>In particular, make sure you are familiar with the
+    <a href="{% url 'journals:journals_terms_and_conditions' %}#license_and_copyright_agreement">
+      license and copyright agreement</a>
+    and the <a href="{% url 'journals:journals_terms_and_conditions' %}#author_obligations">
+      author obligations</a>.</p>
+  <p>Please prepare your manuscript according to the
+    <a href="{% url 'submissions:author_guidelines' %}">author guidelines</a>.</p>
+
+
+  {% if perms.scipost.can_submit_manuscript %}
+
+  <div class="flex-greybox">
+    <h3><em>Please provide the arXiv identifier for your Submission:</em></h3>
+    <p>
+      <em>(give the identifier without prefix but with version number, as per the placeholder)</em>
+    </p>
+    <form action="{% url 'submissions:prefill_using_identifier' %}" method="post">
+      {% csrf_token %}
+      {{ form.as_p }}
+      <input type="submit" value="Query arXiv"/>
+    </form>
+  </div>
+  <br/>
+  <!-- {% if errormessage %}
+  <h3 style="color: red;">Error: {{ errormessage }}</h3>
+  {% endif %} -->
+
+  {% if resubmessage %}
+  <h3 style="color: green;">{{ resubmessage }}</h3>
+  {% endif %}
+
+  {% else %}
+  <h3>You are currently not allowed to submit a manuscript.</h3>
+  {% endif %}
+
+</section>
+
+
+{% endblock bodysup %}
diff --git a/submissions/templates/submissions/submit_manuscript.html b/submissions/templates/submissions/submit_manuscript.html
index 8bb92e95a355883202f2b3350d17ff5991680603..55a6f49aa898a9022d570434037288017dc4ad6d 100644
--- a/submissions/templates/submissions/submit_manuscript.html
+++ b/submissions/templates/submissions/submit_manuscript.html
@@ -68,9 +68,9 @@ $(document).ready(function(){
     </form>
   </div>
   <br/>
-  {% if errormessage %}
+  <!-- {% if errormessage %}
   <h3 style="color: red;">Error: {{ errormessage }}</h3>
-  {% endif %}
+  {% endif %} -->
 
   {% if resubmessage %}
   <h3 style="color: green;">{{ resubmessage }}</h3>
diff --git a/submissions/tests/test_models.py b/submissions/test_models.py
similarity index 100%
rename from submissions/tests/test_models.py
rename to submissions/test_models.py
diff --git a/submissions/test_services.py b/submissions/test_services.py
new file mode 100644
index 0000000000000000000000000000000000000000..420411bdd0fc01cdeb2f0a3792be16b1d96e4f5c
--- /dev/null
+++ b/submissions/test_services.py
@@ -0,0 +1,44 @@
+from django.test import TestCase
+from .services import ArxivCaller
+import pprint
+
+
+class ArxivCallerTest(TestCase):
+
+    def test_correct_lookup(self):
+        caller = ArxivCaller()
+
+        caller.process('1611.09574v1')
+
+        self.assertEqual(caller.is_valid(), True)
+        self.assertIn('entries', caller.metadata)
+
+    def test_errorcode_for_non_existing_paper(self):
+        caller = ArxivCaller()
+
+        caller.process('2611.09574v1')
+        self.assertEqual(caller.is_valid(), False)
+        self.assertEqual(caller.errorcode, 'preprint_does_not_exist')
+
+    def test_errorcode_for_bad_request(self):
+        caller = ArxivCaller()
+
+        caller.process('161109574v1')
+        self.assertEqual(caller.is_valid(), False)
+        self.assertEqual(caller.errorcode, 'arxiv_bad_request')
+
+    def test_errorcode_for_already_published_journal_ref(self):
+        caller = ArxivCaller()
+
+        caller.process('1412.0006v1')
+        self.assertEqual(caller.is_valid(), False)
+        self.assertEqual(caller.errorcode, 'paper_published_journal_ref')
+        self.assertNotEqual(caller.arxiv_journal_ref, '')
+
+    def test_errorcode_no_version_nr(self):
+        # Should be already caught in form validation
+        caller = ArxivCaller()
+
+        caller.process('1412.0006')
+        self.assertEqual(caller.is_valid(), False)
+        self.assertEqual(caller.errorcode, 'bad_identifier')
diff --git a/submissions/test_views.py b/submissions/test_views.py
new file mode 100644
index 0000000000000000000000000000000000000000..5eef315b06ebc633dbb967284d7d0336a8073e17
--- /dev/null
+++ b/submissions/test_views.py
@@ -0,0 +1,47 @@
+from django.test import TestCase
+from django.test import Client
+from submissions.views import *
+import django.core.urlresolvers
+
+
+class PrefillUsingIdentifierTest(TestCase):
+    fixtures = ['permissions', 'groups', 'contributors']
+
+    def test_retrieving_existing_arxiv_paper(self):
+        client = Client()
+        client.login(username="Test", password="testpw")
+
+        response = client.post(reverse('submissions:prefill_using_identifier'),
+                               {'identifier': '1512.00030v1'})
+
+        self.assertEqual(response.status_code, 200)
+
+    def test_still_200_ok_if_identifier_is_wrong(self):
+        client = Client()
+        client.login(username="Test", password="testpw")
+
+        response = client.post(reverse('submissions:prefill_using_identifier'),
+                               {'identifier': '1512.00030'})
+
+        self.assertEqual(response.status_code, 200)
+
+class SubmitManuscriptTest(TestCase):
+    fixtures = ['permissions', 'groups', 'contributors']
+
+    def test_submit_correct_manuscript(self):
+        client = Client()
+        client.login(username="Test", password="testpw")
+
+        response = client.post(reverse('submissions:prefill_using_identifier'),
+                               {'identifier': '1512.00030v1'})
+
+        params = response.context['form'].initial
+
+        extras = {'discipline': 'physics',
+                  'submitted_to_journal': 'SciPost Physics',
+                  'submission_type': 'Article',
+                  'domain': 'T'}
+        response = client.post(reverse('submissions:submit_manuscript'),
+                               {**params, **extras})
+
+        self.assertEqual(response.status_code, 200)
diff --git a/submissions/tests/test_views.py b/submissions/tests/test_views.py
deleted file mode 100644
index f35d237bde6def6e0755612febe441d1d10d6d63..0000000000000000000000000000000000000000
--- a/submissions/tests/test_views.py
+++ /dev/null
@@ -1,27 +0,0 @@
-from django.test import TestCase
-from django.test import Client
-
-from submissions.views import *
-
-
-
-class PrefillUsingIdentifierTest(TestCase):
-    fixtures = ['permissions', 'groups', 'contributors']
-
-    def test_retrieving_existing_arxiv_paper(self):
-        client = Client()
-        client.login(username="Test", password="testpw")
-
-        response = client.post('/submissions/prefill_using_identifier',
-                               {'identifier': '1512.00030v1'})
-
-        self.assertEqual(response.status_code, 200)
-
-    def test_still_200_ok_if_identifier_is_wrong(self):
-        client = Client()
-        client.login(username="Test", password="testpw")
-
-        response = client.post('/submissions/prefill_using_identifier',
-                               {'identifier': '1512.00030'})
-
-        self.assertEqual(response.status_code, 200)
diff --git a/submissions/urls.py b/submissions/urls.py
index e8bd179cf48dd92a26c05fde6a5aa6a9740340a9..58b102c967d8b6ea6c1278c0b162fa48d9387500 100644
--- a/submissions/urls.py
+++ b/submissions/urls.py
@@ -18,9 +18,12 @@ urlpatterns = [
         name='submission_wo_vn_nr'),
     url(r'^(?P<arxiv_identifier_w_vn_nr>[0-9]{4,}.[0-9]{5,}v[0-9]{1,2})/$',
         views.submission_detail, name='submission'),
+    # url(r'^prefill_using_identifier$',
+    #     views.prefill_using_identifier, name='prefill_using_identifier'),
     url(r'^prefill_using_identifier$',
-        views.prefill_using_identifier, name='prefill_using_identifier'),
-    url(r'^submit_manuscript$', views.submit_manuscript, name='submit_manuscript'),
+        views.PrefillUsingIdentifierView.as_view(), name='prefill_using_identifier'),
+    # url(r'^submit_manuscript$', views.submit_manuscript, name='submit_manuscript'),
+    url(r'^submit_manuscript$', views.SubmissionCreateView.as_view(), name='submit_manuscript'),
     url(r'^pool$', views.pool, name='pool'),
     url(r'^add_remark/(?P<arxiv_identifier_w_vn_nr>[0-9]{4,}.[0-9]{5,}v[0-9]{1,2})$',
         views.add_remark, name='add_remark'),
diff --git a/submissions/views.py b/submissions/views.py
index c44ca274fe39818c1a86f74a4ae527602fac06e7..9895f12dd320b32beae03e0848976623603f316e 100644
--- a/submissions/views.py
+++ b/submissions/views.py
@@ -20,6 +20,7 @@ from django.views.decorators.csrf import csrf_protect
 
 from guardian.decorators import permission_required_or_403
 from guardian.shortcuts import assign_perm
+from django.utils.decorators import method_decorator
 
 from .models import *
 from .forms import *
@@ -34,100 +35,140 @@ from scipost.utils import Utils
 
 from comments.forms import CommentForm
 
+from .services import ArxivCaller
+
+from django.views.generic.edit import UpdateView, CreateView, FormView
 
 
 ###############
 # SUBMISSIONS:
 ###############
 
-@permission_required('scipost.can_submit_manuscript', raise_exception=True)
-def prefill_using_identifier(request):
-    if request.method == "POST":
+# @permission_required('scipost.can_submit_manuscript', raise_exception=True)
+# def prefill_using_identifier(request):
+#     if request.method == "POST":
+#         identifierform = SubmissionIdentifierForm(request.POST)
+#         if identifierform.is_valid():
+#             # Use the ArxivCaller class to make the API calls
+#             caller = ArxivCaller()
+#             caller.process(identifierform.cleaned_data['identifier'])
+#
+#             if caller.is_valid():
+#                 # Arxiv response is valid and can be shown
+#
+#                 metadata = caller.metadata
+#                 is_resubmission = caller.resubmission
+#                 title = metadata['entries'][0]['title']
+#                 authorlist = metadata['entries'][0]['authors'][0]['name']
+#                 for author in metadata['entries'][0]['authors'][1:]:
+#                     authorlist += ', ' + author['name']
+#                 arxiv_link = metadata['entries'][0]['id']
+#                 abstract = metadata['entries'][0]['summary']
+#                 initialdata = {'is_resubmission': is_resubmission,
+#                                'metadata': metadata,
+#                                'title': title, 'author_list': authorlist,
+#                                'arxiv_identifier_w_vn_nr': caller.identifier_with_vn_nr,
+#                                'arxiv_identifier_wo_vn_nr': caller.identifier_without_vn_nr,
+#                                'arxiv_vn_nr': caller.version_nr,
+#                                'arxiv_link': arxiv_link, 'abstract': abstract}
+#                 if is_resubmission:
+#                     resubmessage = ('There already exists a preprint with this arXiv identifier '
+#                                     'but a different version number. \nYour Submission will be '
+#                                     'handled as a resubmission.')
+#                     initialdata['submitted_to_journal'] = previous_submissions[0].submitted_to_journal
+#                     initialdata['submission_type'] = previous_submissions[0].submission_type
+#                     initialdata['discipline'] = previous_submissions[0].discipline
+#                     initialdata['domain'] = previous_submissions[0].domain
+#                     initialdata['subject_area'] = previous_submissions[0].subject_area
+#                     initialdata['secondary_areas'] = previous_submissions[0].secondary_areas
+#                     initialdata['referees_suggested'] = previous_submissions[0].referees_suggested
+#                     initialdata['referees_flagged'] = previous_submissions[0].referees_flagged
+#                 else:
+#                     resubmessage = ''
+#
+#                 form = SubmissionForm(initial=initialdata)
+#                 context = {'identifierform': identifierform,
+#                            'form': form,
+#                            'resubmessage': resubmessage}
+#                 return render(request, 'submissions/submit_manuscript.html', context)
+#
+#             else:
+#                 # Arxiv response is not valid
+#                 errormessages = {
+#                     'preprint_does_not_exist':
+#                         'A preprint associated to this identifier does not exist.',
+#                     'paper_published_journal_ref':
+#                         ('This paper has been published as ' + caller.arxiv_journal_ref +
+#                          '. You cannot submit it to SciPost anymore.'),
+#                     'paper_published_doi':
+#                         ('This paper has been published under DOI ' + caller.arxiv_doi +
+#                          '. You cannot submit it to SciPost anymore.'),
+#                     'arxiv_timeout': 'Arxiv did not respond in time. Please try again later',
+#                     'arxiv_bad_request':
+#                         ('There was an error with requesting identifier ' +
+#                          caller.identifier_with_vn_nr +
+#                          ' from Arxiv. Please check the identifier and try again.'),
+#                     'previous_submission_undergoing_refereeing':
+#                         ('There exists a preprint with this arXiv identifier '
+#                          'but an earlier version number, which is still undergoing '
+#                          'peer refereeing.'
+#                          'A resubmission can only be performed after request '
+#                          'from the Editor-in-charge. Please wait until the '
+#                          'closing of the previous refereeing round and '
+#                          'formulation of the Editorial Recommendation '
+#                          'before proceeding with a resubmission.'),
+#                     'preprint_already_submitted': 'This preprint version has already been submitted to SciPost.'
+#                 }
+#
+#                 identifierform.add_error(None, errormessages[caller.errorcode])
+#                 form = SubmissionForm()
+#                 return render(request, 'submissions/submit_manuscript.html',
+#                               {'identifierform': identifierform, 'form': form})
+#         else:
+#             form = SubmissionForm()
+#             return render(request, 'submissions/submit_manuscript.html',
+#                           {'identifierform': identifierform, 'form': form})
+#     # return redirect(reverse('submissions:submit_manuscript'))
+#     form = SubmissionForm()
+#     identifierform = SubmissionIdentifierForm()
+#     return render(request, 'submissions/submit_manuscript.html',
+#                   {'identifierform': identifierform, 'form': form})
+
+
+class PrefillUsingIdentifierView(FormView):
+    form_class = SubmissionIdentifierForm
+    template_name = 'submissions/prefill_using_identifier.html'
+
+    def post(self, request):
         identifierform = SubmissionIdentifierForm(request.POST)
         if identifierform.is_valid():
-            # Perform Arxiv query and check if results are OK for submission
-            metadata, errormessage = lookup_article(identifierform.cleaned_data['identifier'])
-
-            if not metadata:
-                form = SubmissionForm()
-                return render(request, 'submissions/submit_manuscript.html',
-                              {'identifierform': identifierform, 'form': form,
-                               'errormessage': errormessage})
-
-            is_resubmission = False
-            resubmessage = ''
-            previous_submissions = Submission.objects.filter(
-                arxiv_identifier_wo_vn_nr=identifier_without_vn_nr).order_by('-arxiv_vn_nr')
-            if previous_submissions.exists():
-                if previous_submissions[0].status in ['rejected', 'rejected_visible',]:
-                    errormessage = ('<p>This arXiv preprint has previously undergone refereeing '
-                                    'and has been rejected. Resubmission is only possible '
-                                    'if the manuscript has been substantially reworked into '
-                                    'a new arXiv submission with distinct identifier.</p>')
-                    return render(request, 'scipost/error.html',
-                                  {'errormessage': mark_safe(errormessage)})
-                # If the Editorial Recommendation hasn't been formulated, ask to wait
-                if previous_submissions[0].status != 'revision_requested':
-                    errormessage = ('<p>There exists a preprint with this arXiv identifier '
-                                    'but an earlier version number, which is still undergoing '
-                                    'peer refereeing.</p>'
-                                    '<p>A resubmission can only be performed after request '
-                                    'from the Editor-in-charge. Please wait until the '
-                                    'closing of the previous refereeing round and '
-                                    'formulation of the Editorial Recommendation '
-                                    'before proceeding with a resubmission.</p>')
-                    return render(request, 'scipost/error.html',
-                                  {'errormessage': mark_safe(errormessage)})
-                is_resubmission = True
-                resubmessage = ('There already exists a preprint with this arXiv identifier '
-                                'but a different version number. \nYour Submission will be '
-                                'handled as a resubmission.')
-            try:
-                queryurl = ('http://export.arxiv.org/api/query?id_list=%s'
-                            % identifierform.cleaned_data['identifier'])
-                arxivquery = feedparser.parse(queryurl)
-                # Flag error if preprint doesn't exist
-                try:
-                    test = arxivquery['entries'][0]['title']
-                except KeyError:
-                    errormessage = 'A preprint associated to this identifier does not exist.'
-                except:
-                    pass
-
-                # If paper has been published, should comment on published version
-                try:
-                    arxiv_journal_ref = arxivquery['entries'][0]['arxiv_journal_ref']
-                    errormessage = ('This paper has been published as ' + arxiv_journal_ref +
-                                    '. You cannot submit it to SciPost anymore.')
-                except:
-                    pass
-                try:
-                    arxiv_doi = arxivquery['entries'][0]['arxiv_doi']
-                    errormessage = ('This paper has been published under DOI ' + arxiv_DOI
-                                    + '. You cannot submit it to SciPost anymore.')
-                except:
-                    pass
-                if errormessage != '':
-                    form = SubmissionForm()
-                    context = {'identifierform': identifierform, 'form': form,
-                               'errormessage': errormessage}
-                    return render(request, 'submissions/submit_manuscript.html', context)
-
-                metadata = arxivquery
-                title = arxivquery['entries'][0]['title']
-                authorlist = arxivquery['entries'][0]['authors'][0]['name']
-                for author in arxivquery['entries'][0]['authors'][1:]:
+            # Use the ArxivCaller class to make the API calls
+            caller = ArxivCaller()
+            caller.process(identifierform.cleaned_data['identifier'])
+
+            if caller.is_valid():
+                # Arxiv response is valid and can be shown
+
+                metadata = caller.metadata
+                is_resubmission = caller.resubmission
+                title = metadata['entries'][0]['title']
+                authorlist = metadata['entries'][0]['authors'][0]['name']
+                for author in metadata['entries'][0]['authors'][1:]:
                     authorlist += ', ' + author['name']
-                arxiv_link = arxivquery['entries'][0]['id']
-                abstract = arxivquery['entries'][0]['summary']
-                initialdata={'is_resubmission': is_resubmission,
-                             'metadata': metadata,
-                             'title': title, 'author_list': authorlist,
-                             'arxiv_identifier_w_vn_nr': identifierform.cleaned_data['identifier'],
-                             'arxiv_identifier_wo_vn_nr': identifier_without_vn_nr,
-                             'arxiv_vn_nr': arxiv_vn_nr,
-                             'arxiv_link': arxiv_link, 'abstract': abstract}
+                arxiv_link = metadata['entries'][0]['id']
+                abstract = metadata['entries'][0]['summary']
+                initialdata = {'is_resubmission': is_resubmission,
+                               'metadata': metadata,
+                               'title': title, 'author_list': authorlist,
+                               'arxiv_identifier_w_vn_nr': caller.identifier_with_vn_nr,
+                               'arxiv_identifier_wo_vn_nr': caller.identifier_without_vn_nr,
+                               'arxiv_vn_nr': caller.version_nr,
+                               'arxiv_link': arxiv_link, 'abstract': abstract}
                 if is_resubmission:
+                    previous_submissions = caller.previous_submissions
+                    resubmessage = ('There already exists a preprint with this arXiv identifier '
+                                    'but a different version number. \nYour Submission will be '
+                                    'handled as a resubmission.')
                     initialdata['submitted_to_journal'] = previous_submissions[0].submitted_to_journal
                     initialdata['submission_type'] = previous_submissions[0].submission_type
                     initialdata['discipline'] = previous_submissions[0].discipline
@@ -136,131 +177,241 @@ def prefill_using_identifier(request):
                     initialdata['secondary_areas'] = previous_submissions[0].secondary_areas
                     initialdata['referees_suggested'] = previous_submissions[0].referees_suggested
                     initialdata['referees_flagged'] = previous_submissions[0].referees_flagged
+                else:
+                    resubmessage = ''
+
                 form = SubmissionForm(initial=initialdata)
                 context = {'identifierform': identifierform,
                            'form': form,
                            'resubmessage': resubmessage}
-                return render(request, 'submissions/submit_manuscript.html', context)
-            except:
-                print("Unexpected error in prefill_using_identifier:", sys.exc_info()[0])
-                context = {'identifierform': identifierform,
-                           'form': SubmissionForm(),
-                           'errormessage': errormessage,}
-                return render(request, 'submissions/submit_manuscript.html', context)
+                return render(request, 'submissions/new_submission.html', context)
+
+            else:
+                # Arxiv response is not valid
+                errormessages = {
+                    'preprint_does_not_exist':
+                        'A preprint associated to this identifier does not exist.',
+                    'paper_published_journal_ref':
+                        ('This paper has been published as ' + caller.arxiv_journal_ref +
+                         '. You cannot submit it to SciPost anymore.'),
+                    'paper_published_doi':
+                        ('This paper has been published under DOI ' + caller.arxiv_doi +
+                         '. You cannot submit it to SciPost anymore.'),
+                    'arxiv_timeout': 'Arxiv did not respond in time. Please try again later',
+                    'arxiv_bad_request':
+                        ('There was an error with requesting identifier ' +
+                         caller.identifier_with_vn_nr +
+                         ' from Arxiv. Please check the identifier and try again.'),
+                    'previous_submission_undergoing_refereeing':
+                        ('There exists a preprint with this arXiv identifier '
+                         'but an earlier version number, which is still undergoing '
+                         'peer refereeing.'
+                         'A resubmission can only be performed after request '
+                         'from the Editor-in-charge. Please wait until the '
+                         'closing of the previous refereeing round and '
+                         'formulation of the Editorial Recommendation '
+                         'before proceeding with a resubmission.'),
+                    'preprint_already_submitted': 'This preprint version has already been submitted to SciPost.',
+                    'previous_submissions_rejected':
+                        ('This arXiv preprint has previously undergone refereeing '
+                         'and has been rejected. Resubmission is only possible '
+                         'if the manuscript has been substantially reworked into '
+                         'a new arXiv submission with distinct identifier.')
+                }
+
+                identifierform.add_error(None, errormessages[caller.errorcode])
+                return render(request, 'submissions/prefill_using_identifier.html',
+                              {'form': identifierform})
         else:
-            form = SubmissionForm()
-            return render(request, 'submissions/submit_manuscript.html',
-                          {'identifierform': identifierform, 'form': form})
-    return redirect(reverse('submissions:submit_manuscript'))
+            return render(request, 'submissions/prefill_using_identifier.html',
+                          {'form': identifierform})
+
+class SubmissionCreateView(CreateView):
+
+    model = Submission
+    fields = [
+        'is_resubmission',
+        'discipline',
+        'submitted_to_journal',
+        'submission_type',
+        'domain',
+        'subject_area',
+        'secondary_areas',
+        'title',
+        'author_list',
+        'abstract',
+        'arxiv_identifier_w_vn_nr',
+        'arxiv_identifier_wo_vn_nr',
+        'arxiv_vn_nr',
+        'arxiv_link',
+        'metadata',
+        'author_comments',
+        'list_of_changes',
+        'remarks_for_editors',
+        'referees_suggested',
+        'referees_flagged'
+    ]
+
+    template_name = 'submissions/new_submission.html'
+
+    def get(self, request):
+        # Only use prefilled forms
+        return redirect('submissions:prefill_using_identifier')
+
+    @transaction.atomic
+    def form_valid(self, form):
+        submitted_by = Contributor.objects.get(user=self.request.user)
+        form.instance.submitted_by = submitted_by
+
+        # Save all the information contained in the form
+        submission = form.save()
+
+        # Perform all extra actions and set information not contained in the form
+        submission.finish_submission()
+
+        if submission.is_resubmission:
+            # Assign permissions
+            assign_perm('can_take_editorial_actions', submission.editor_in_charge.user, submission)
+            ed_admins = Group.objects.get(name='Editorial Administrators')
+            assign_perm('can_take_editorial_actions', ed_admins, submission)
+
+            # Send emails
+            SubmissionUtils.load({'submission': submission})
+            SubmissionUtils.send_authors_resubmission_ack_email()
+            SubmissionUtils.send_EIC_reappointment_email()
+        else:
+            # Send emails
+            SubmissionUtils.load({'submission': submission})
+            SubmissionUtils.send_authors_submission_ack_email()
+
+        context = {'ack_header': 'Thank you for your Submission to SciPost',
+                   'ack_message': 'Your Submission will soon be handled by an Editor. ',
+                   'followup_message': 'Return to your ',
+                   'followup_link': reverse('scipost:personal_page'),
+                   'followup_link_label': 'personal page'}
+        return render(self.request, 'scipost/acknowledgement.html', context)
+
+    def mark_previous_submissions_as_deprecated(self, previous_submissions):
+        for sub in previous_submissions:
+            sub.is_current = False
+            sub.open_for_reporting = False
+            sub.status = 'resubmitted'
+            sub.save()
+
+    def previous_submissions(self, form):
+        return Submission.objects.filter(
+            arxiv_identifier_wo_vn_nr=form.cleaned_data['arxiv_identifier_wo_vn_nr']
+        )
 
 
-@login_required
-@permission_required('scipost.can_submit_manuscript', raise_exception=True)
-@transaction.atomic
-def submit_manuscript(request):
-    if request.method == 'POST':
-        form = SubmissionForm(request.POST)
-        if form.is_valid():
-            submitted_by = Contributor.objects.get(user=request.user)
-            # Verify if submitter is among the authors
-            if not submitted_by.user.last_name in form.cleaned_data['author_list']:
-                errormessage = ('Your name does not match that of any of the authors. '
-                                'You are not authorized to submit this preprint.')
-                identifierform = SubmissionIdentifierForm()
-                return render(request, 'submissions/submit_manuscript.html',
-                              {'identifierform': identifierform, 'form': form,
-                               'errormessage': errormessage})
-            submission = Submission(
-                is_current = True,
-                is_resubmission = form.cleaned_data['is_resubmission'],
-                submitted_by = submitted_by,
-                submitted_to_journal = form.cleaned_data['submitted_to_journal'],
-                submission_type = form.cleaned_data['submission_type'],
-                discipline = form.cleaned_data['discipline'],
-                domain = form.cleaned_data['domain'],
-#                specialization = form.cleaned_data['specialization'],
-                subject_area = form.cleaned_data['subject_area'],
-                secondary_areas = form.cleaned_data['secondary_areas'],
-                status = 'unassigned',
-                title = form.cleaned_data['title'],
-                author_list = form.cleaned_data['author_list'],
-                abstract = form.cleaned_data['abstract'],
-                arxiv_identifier_w_vn_nr = form.cleaned_data['arxiv_identifier_w_vn_nr'],
-                arxiv_identifier_wo_vn_nr = form.cleaned_data['arxiv_identifier_wo_vn_nr'],
-                arxiv_vn_nr = form.cleaned_data['arxiv_vn_nr'],
-                arxiv_link = form.cleaned_data['arxiv_link'],
-                metadata = form.cleaned_data['metadata'],
-                submission_date = timezone.now(),
-                remarks_for_editors = form.cleaned_data['remarks_for_editors'],
-                referees_suggested = form.cleaned_data['referees_suggested'],
-                referees_flagged = form.cleaned_data['referees_flagged'],
-                )
-            submission.save()
-            submission.authors.add(submitted_by) # must be author to be able to submit
-            submission.save()
-            # If this is a resubmission, mark previous submissions as deprecated:
-            if form.cleaned_data['is_resubmission']:
-                previous_submissions = Submission.objects.filter(
-                    arxiv_identifier_wo_vn_nr=form.cleaned_data['arxiv_identifier_wo_vn_nr']
-                ).exclude(pk=submission.id).order_by('-arxiv_vn_nr')
-                for sub in previous_submissions:
-                    sub.is_current = False
-                    sub.open_for_reporting = False
-                    sub.status = 'resubmitted'
-                    sub.save()
-                # Handle this submission in same way as if assignment had been accepted
-                submission.open_for_reporting = True
-                deadline = timezone.now() + datetime.timedelta(days=28) # for papers
-                if submission.submitted_to_journal == 'SciPost Physics Lecture Notes':
-                    deadline += datetime.timedelta(days=28)
-                submission.reporting_deadline = deadline
-                submission.open_for_commenting = True
-                submission.latest_activity = timezone.now()
-                # We keep the same (most recent) Editor-in-charge by default
-                submission.editor_in_charge = previous_submissions[0].editor_in_charge
-                submission.status = 'EICassigned'
-                # Keep the info about authors:
-                for author in previous_submissions[0].authors.all():
-                    submission.authors.add(author)
-                for author in previous_submissions[0].authors_claims.all():
-                    submission.authors_claims.add(author)
-                for author in previous_submissions[0].authors_false_claims.all():
-                    submission.authors_false_claims.add(author)
-                submission.author_comments = form.cleaned_data['author_comments']
-                submission.list_of_changes = form.cleaned_data['list_of_changes']
-                submission.save()
-                assignment = EditorialAssignment(
-                    submission=submission,
-                    to=submission.editor_in_charge,
-                    accepted=True,
-                    date_created=timezone.now(),
-                    date_answered=timezone.now(),
-                )
-                assignment.save()
-                SubmissionUtils.load({'submission': submission})
-                SubmissionUtils.send_authors_resubmission_ack_email()
-                assign_perm('can_take_editorial_actions', submission.editor_in_charge.user, submission)
-                ed_admins = Group.objects.get(name='Editorial Administrators')
-                assign_perm('can_take_editorial_actions', ed_admins, submission)
-                SubmissionUtils.send_EIC_reappointment_email()
-            else:
-                SubmissionUtils.load({'submission': submission})
-                SubmissionUtils.send_authors_submission_ack_email()
-
-            #return HttpResponseRedirect(reverse('submissions:submit_manuscript_ack'))
-            context = {'ack_header': 'Thank you for your Submission to SciPost',
-                       'ack_message': 'Your Submission will soon be handled by an Editor. ',
-                       'followup_message': 'Return to your ',
-                       'followup_link': reverse('scipost:personal_page'),
-                       'followup_link_label': 'personal page'}
-            return render(request, 'scipost/acknowledgement.html', context)
-        else: # form is invalid
-            pass
-    else:
-        form = SubmissionForm()
-    identifierform = SubmissionIdentifierForm()
-    return render(request, 'submissions/submit_manuscript.html',
-                  {'identifierform': identifierform, 'form': form})
+
+
+# @login_required
+# @permission_required('scipost.can_submit_manuscript', raise_exception=True)
+# @transaction.atomic
+# def submit_manuscript(request):
+#     if request.method == 'POST':
+#         form = SubmissionForm(request.POST)
+#         if form.is_valid():
+#             submitted_by = Contributor.objects.get(user=request.user)
+#             # Verify if submitter is among the authors
+            # if submitted_by.user.last_name not in form.cleaned_data['author_list']:
+            #     errormessage = ('Your name does not match that of any of the authors. '
+            #                     'You are not authorized to submit this preprint.')
+            #     identifierform = SubmissionIdentifierForm()
+            #     return render(request, 'submissions/submit_manuscript.html',
+            #                   {'identifierform': identifierform, 'form': form,
+            #                    'errormessage': errormessage})
+#             submission = Submission(
+#                 is_current=True,
+#                 is_resubmission=form.cleaned_data['is_resubmission'],
+#                 submitted_by=submitted_by,
+#                 submitted_to_journal=form.cleaned_data['submitted_to_journal'],
+#                 submission_type=form.cleaned_data['submission_type'],
+#                 discipline=form.cleaned_data['discipline'],
+#                 domain=form.cleaned_data['domain'],
+#                 subject_area=form.cleaned_data['subject_area'],
+#                 secondary_areas=form.cleaned_data['secondary_areas'],
+#                 status='unassigned',
+#                 title=form.cleaned_data['title'],
+#                 author_list=form.cleaned_data['author_list'],
+#                 abstract=form.cleaned_data['abstract'],
+#                 arxiv_identifier_w_vn_nr=form.cleaned_data['arxiv_identifier_w_vn_nr'],
+#                 arxiv_identifier_wo_vn_nr=form.cleaned_data['arxiv_identifier_wo_vn_nr'],
+#                 arxiv_vn_nr=form.cleaned_data['arxiv_vn_nr'],
+#                 arxiv_link=form.cleaned_data['arxiv_link'],
+#                 metadata=form.cleaned_data['metadata'],
+#                 submission_date=timezone.now(),
+#                 remarks_for_editors=form.cleaned_data['remarks_for_editors'],
+#                 referees_suggested=form.cleaned_data['referees_suggested'],
+#                 referees_flagged=form.cleaned_data['referees_flagged'],
+#             )
+#             submission.save()
+#             submission.authors.add(submitted_by)  # must be author to be able to submit
+#             submission.save()
+#             # If this is a resubmission, mark previous submissions as deprecated:
+#             if form.cleaned_data['is_resubmission']:
+#                 previous_submissions = Submission.objects.filter(
+#                     arxiv_identifier_wo_vn_nr=form.cleaned_data['arxiv_identifier_wo_vn_nr']
+#                 ).exclude(pk=submission.id).order_by('-arxiv_vn_nr')
+#                 for sub in previous_submissions:
+#                     sub.is_current = False
+#                     sub.open_for_reporting = False
+#                     sub.status = 'resubmitted'
+#                     sub.save()
+#                 # Handle this submission in same way as if assignment had been accepted
+#                 submission.open_for_reporting = True
+#                 deadline = timezone.now() + datetime.timedelta(days=28)  # for papers
+#                 if submission.submitted_to_journal == 'SciPost Physics Lecture Notes':
+#                     deadline += datetime.timedelta(days=28)
+#                 submission.reporting_deadline = deadline
+#                 submission.open_for_commenting = True
+#                 submission.latest_activity = timezone.now()
+#                 # We keep the same (most recent) Editor-in-charge by default
+#                 submission.editor_in_charge = previous_submissions[0].editor_in_charge
+#                 submission.status = 'EICassigned'
+#                 # Keep the info about authors:
+#                 for author in previous_submissions[0].authors.all():
+#                     submission.authors.add(author)
+#                 for author in previous_submissions[0].authors_claims.all():
+#                     submission.authors_claims.add(author)
+#                 for author in previous_submissions[0].authors_false_claims.all():
+#                     submission.authors_false_claims.add(author)
+#                 submission.author_comments = form.cleaned_data['author_comments']
+#                 submission.list_of_changes = form.cleaned_data['list_of_changes']
+#                 submission.save()
+#                 assignment = EditorialAssignment(
+#                     submission=submission,
+#                     to=submission.editor_in_charge,
+#                     accepted=True,
+#                     date_created=timezone.now(),
+#                     date_answered=timezone.now(),
+#                 )
+#                 assignment.save()
+#                 SubmissionUtils.load({'submission': submission})
+#                 SubmissionUtils.send_authors_resubmission_ack_email()
+#                 assign_perm('can_take_editorial_actions', submission.editor_in_charge.user, submission)
+#                 ed_admins = Group.objects.get(name='Editorial Administrators')
+#                 assign_perm('can_take_editorial_actions', ed_admins, submission)
+#                 SubmissionUtils.send_EIC_reappointment_email()
+#             else:
+#                 SubmissionUtils.load({'submission': submission})
+#                 SubmissionUtils.send_authors_submission_ack_email()
+#
+#             # return HttpResponseRedirect(reverse('submissions:submit_manuscript_ack'))
+#             context = {'ack_header': 'Thank you for your Submission to SciPost',
+#                        'ack_message': 'Your Submission will soon be handled by an Editor. ',
+#                        'followup_message': 'Return to your ',
+#                        'followup_link': reverse('scipost:personal_page'),
+#                        'followup_link_label': 'personal page'}
+#             return render(request, 'scipost/acknowledgement.html', context)
+#         else:  # form is invalid
+#             pass
+#     else:
+#         form = SubmissionForm()
+#     identifierform = SubmissionIdentifierForm()
+#     return render(request, 'submissions/submit_manuscript.html',
+#                   {'identifierform': identifierform, 'form': form})
 
 
 def submissions(request, to_journal=None):
@@ -274,8 +425,8 @@ def submissions(request, to_journal=None):
                 title__icontains=form.cleaned_data['title_keyword'],
                 author_list__icontains=form.cleaned_data['author'],
                 abstract__icontains=form.cleaned_data['abstract_keyword'],
-                ).exclude(status__in=SUBMISSION_STATUS_PUBLICLY_UNLISTED,
-                ).order_by('-submission_date')
+            ).exclude(status__in=SUBMISSION_STATUS_PUBLICLY_UNLISTED,
+                      ).order_by('-submission_date')
         else:
             submission_search_list = []
 
@@ -286,12 +437,12 @@ def submissions(request, to_journal=None):
     submission_recent_list = Submission.objects.filter(
         latest_activity__gte=timezone.now() + datetime.timedelta(days=-60)
     ).exclude(status__in=SUBMISSION_STATUS_PUBLICLY_UNLISTED
-    ).exclude(is_current=False).order_by('-submission_date')
+              ).exclude(is_current=False).order_by('-submission_date')
     # If doing a journal-specific listing:
     if to_journal is not None:
         submission_recent_list.filter(submitted_to_journal=to_journal)
     context = {'form': form, 'submission_search_list': submission_search_list,
-               'submission_recent_list': submission_recent_list }
+               'submission_recent_list': submission_recent_list}
     return render(request, 'submissions/submissions.html', context)
 
 
@@ -303,21 +454,21 @@ def browse(request, discipline, nrweeksback):
                 title__icontains=form.cleaned_data['title_keyword'],
                 author_list__icontains=form.cleaned_data['author'],
                 abstract__icontains=form.cleaned_data['abstract_keyword'],
-                ).exclude(status__in=SUBMISSION_STATUS_PUBLICLY_UNLISTED,
-                ).order_by('-submission_date')
+            ).exclude(status__in=SUBMISSION_STATUS_PUBLICLY_UNLISTED,
+                      ).order_by('-submission_date')
         else:
             submission_search_list = []
-        context = {'form': form, 'submission_search_list': submission_search_list }
+        context = {'form': form, 'submission_search_list': submission_search_list}
         return HttpResponseRedirect(request, 'submissions/submissions.html', context)
     else:
         form = SubmissionSearchForm()
     submission_browse_list = Submission.objects.filter(
         discipline=discipline,
         latest_activity__gte=timezone.now() + datetime.timedelta(weeks=-int(nrweeksback))
-        ).exclude(status__in=SUBMISSION_STATUS_PUBLICLY_UNLISTED
-        ).exclude(is_current=False).order_by('-submission_date')
+    ).exclude(status__in=SUBMISSION_STATUS_PUBLICLY_UNLISTED
+              ).exclude(is_current=False).order_by('-submission_date')
     context = {'form': form, 'discipline': discipline, 'nrweeksback': nrweeksback,
-               'submission_browse_list': submission_browse_list }
+               'submission_browse_list': submission_browse_list}
     return render(request, 'submissions/submissions.html', context)
 
 
@@ -348,26 +499,24 @@ def submission_detail(request, arxiv_identifier_w_vn_nr):
         form = CommentForm(request.POST)
         if form.is_valid():
             author = Contributor.objects.get(user=request.user)
-            newcomment = Comment (
-                submission = submission,
-                author = author,
-                is_rem = form.cleaned_data['is_rem'],
-                is_que = form.cleaned_data['is_que'],
-                is_ans = form.cleaned_data['is_ans'],
-                is_obj = form.cleaned_data['is_obj'],
-                is_rep = form.cleaned_data['is_rep'],
-                is_val = form.cleaned_data['is_val'],
-                is_lit = form.cleaned_data['is_lit'],
-                is_sug = form.cleaned_data['is_sug'],
-                comment_text = form.cleaned_data['comment_text'],
-                remarks_for_editors = form.cleaned_data['remarks_for_editors'],
-                date_submitted = timezone.now(),
-                )
+            newcomment = Comment(
+                submission=submission,
+                author=author,
+                is_rem=form.cleaned_data['is_rem'],
+                is_que=form.cleaned_data['is_que'],
+                is_ans=form.cleaned_data['is_ans'],
+                is_obj=form.cleaned_data['is_obj'],
+                is_rep=form.cleaned_data['is_rep'],
+                is_val=form.cleaned_data['is_val'],
+                is_lit=form.cleaned_data['is_lit'],
+                is_sug=form.cleaned_data['is_sug'],
+                comment_text=form.cleaned_data['comment_text'],
+                remarks_for_editors=form.cleaned_data['remarks_for_editors'],
+                date_submitted=timezone.now(),
+            )
             newcomment.save()
             author.nr_comments = Comment.objects.filter(author=author).count()
             author.save()
-            #request.session['arxiv_identifier_w_vn_nr'] = submission.arxiv_identifier_w_vn_nr
-            #return HttpResponseRedirect(reverse('comments:comment_submission_ack'))
             context = {'ack_header': 'Thank you for contributing a Comment.',
                        'ack_message': 'It will soon be vetted by an Editor.',
                        'followup_message': 'Back to the ',
@@ -376,7 +525,7 @@ def submission_detail(request, arxiv_identifier_w_vn_nr):
                            kwargs={'arxiv_identifier_w_vn_nr': newcomment.submission.arxiv_identifier_w_vn_nr}
                        ),
                        'followup_link_label': ' Submission page you came from'
-                   }
+                       }
             return render(request, 'scipost/acknowledgement.html', context)
     else:
         form = CommentForm()
@@ -391,9 +540,9 @@ def submission_detail(request, arxiv_identifier_w_vn_nr):
     # To check in template whether the user can submit a report:
     try:
         is_author = request.user.contributor in submission.authors.all()
-        is_author_unchecked = (not is_author
-                               and not (request.user.contributor in submission.authors_false_claims.all())
-                               and (request.user.last_name in submission.author_list))
+        is_author_unchecked = (not is_author and not
+                               (request.user.contributor in submission.authors_false_claims.all()) and
+                               (request.user.last_name in submission.author_list))
     except AttributeError:
         is_author = False
         is_author_unchecked = False
@@ -436,10 +585,10 @@ def pool(request):
     to publication acceptance or rejection.
     All members of the Editorial College have access.
     """
-    submissions_in_pool=(Submission.objects.all()
-                         .exclude(status__in=SUBMISSION_STATUS_OUT_OF_POOL)
-                         .exclude(is_current=False)
-                         .order_by('-submission_date'))
+    submissions_in_pool = (Submission.objects.all()
+                           .exclude(status__in=SUBMISSION_STATUS_OUT_OF_POOL)
+                           .exclude(is_current=False)
+                           .order_by('-submission_date'))
     recommendations_undergoing_voting = (EICRecommendation.objects.filter(
         submission__status__in=['put_to_EC_voting']))
     recommendations_to_prepare_for_voting = (EICRecommendation.objects.filter(
@@ -500,7 +649,6 @@ def add_remark(request, arxiv_identifier_w_vn_nr):
 def assign_submission(request, arxiv_identifier_w_vn_nr):
     submission_to_assign = get_object_or_404(Submission,
                                              arxiv_identifier_w_vn_nr=arxiv_identifier_w_vn_nr)
-    #form = AssignSubmissionForm(discipline=submission_to_assign.discipline, subject_area=submission_to_assign.subject_area) # reactivate later on
     form = AssignSubmissionForm(discipline=submission_to_assign.discipline)
     context = {'submission_to_assign': submission_to_assign,
                'form': form}
@@ -540,7 +688,7 @@ def assign_submission_ack(request, arxiv_identifier_w_vn_nr):
 @transaction.atomic
 def accept_or_decline_assignment_ack(request, assignment_id):
     contributor = Contributor.objects.get(user=request.user)
-    assignment = get_object_or_404 (EditorialAssignment, pk=assignment_id)
+    assignment = get_object_or_404(EditorialAssignment, pk=assignment_id)
     errormessage = None
     if assignment.submission.status == 'assignment_failed':
         errormessage = 'This Submission has failed pre-screening and has been rejected.'
@@ -562,7 +710,7 @@ def accept_or_decline_assignment_ack(request, assignment_id):
                 assignment.submission.status = 'EICassigned'
                 assignment.submission.editor_in_charge = contributor
                 assignment.submission.open_for_reporting = True
-                deadline = timezone.now() + datetime.timedelta(days=28) # for papers
+                deadline = timezone.now() + datetime.timedelta(days=28)  # for papers
                 if assignment.submission.submitted_to_journal == 'SciPost Physics Lecture Notes':
                     deadline += datetime.timedelta(days=28)
                 assignment.submission.reporting_deadline = deadline
@@ -613,7 +761,7 @@ def volunteer_as_EIC(request, arxiv_identifier_w_vn_nr):
                                      accepted=True,
                                      date_created=timezone.now(),
                                      date_answered=timezone.now())
-    deadline = timezone.now() + datetime.timedelta(days=28) # for papers
+    deadline = timezone.now() + datetime.timedelta(days=28)  # for papers
     if submission.submitted_to_journal == 'SciPost Physics Lecture Notes':
         deadline += datetime.timedelta(days=28)
     submission.status = 'EICassigned'
@@ -760,25 +908,25 @@ def recruit_referee(request, arxiv_identifier_w_vn_nr):
                 last_name=ref_recruit_form.cleaned_data['last_name'],
                 email_address=ref_recruit_form.cleaned_data['email_address'],
                 date_invited=timezone.now(),
-                invited_by = request.user.contributor)
+                invited_by=request.user.contributor)
             ref_invitation.save()
             # Create and send a registration invitation
             ref_inv_message_head = ('On behalf of the Editor-in-charge ' +
                                     title_dict[submission.editor_in_charge.title] + ' ' +
                                     submission.editor_in_charge.user.last_name +
-                                    ', we would like to invite you to referee a Submission to '
-                                    + journals_submit_dict[submission.submitted_to_journal]
-                                    + ', namely\n\n' + submission.title
-                                    + '\nby ' + submission.author_list + '.')
-            reg_invitation = RegistrationInvitation (
-                title = ref_recruit_form.cleaned_data['title'],
-                first_name = ref_recruit_form.cleaned_data['first_name'],
-                last_name = ref_recruit_form.cleaned_data['last_name'],
-                email = ref_recruit_form.cleaned_data['email_address'],
-                invitation_type = 'R',
-                invited_by = request.user.contributor,
-                message_style = 'F',
-                personal_message = ref_inv_message_head,
+                                    ', we would like to invite you to referee a Submission to ' +
+                                    journals_submit_dict[submission.submitted_to_journal] +
+                                    ', namely\n\n' + submission.title +
+                                    '\nby ' + submission.author_list + '.')
+            reg_invitation = RegistrationInvitation(
+                title=ref_recruit_form.cleaned_data['title'],
+                first_name=ref_recruit_form.cleaned_data['first_name'],
+                last_name=ref_recruit_form.cleaned_data['last_name'],
+                email=ref_recruit_form.cleaned_data['email_address'],
+                invitation_type='R',
+                invited_by=request.user.contributor,
+                message_style='F',
+                personal_message=ref_inv_message_head,
             )
             reg_invitation.save()
             Utils.load({'invitation': reg_invitation})
@@ -834,7 +982,7 @@ def ref_invitation_reminder(request, arxiv_identifier_w_vn_nr, invitation_id):
     when a referee has been invited but hasn't answered yet.
     It can be used for registered as well as unregistered referees.
     """
-    invitation = get_object_or_404 (RefereeInvitation, pk=invitation_id)
+    invitation = get_object_or_404(RefereeInvitation, pk=invitation_id)
     invitation.nr_reminders += 1
     invitation.date_last_reminded = timezone.now()
     invitation.save()
@@ -858,7 +1006,7 @@ def accept_or_decline_ref_invitations(request):
 @permission_required('scipost.can_referee', raise_exception=True)
 def accept_or_decline_ref_invitation_ack(request, invitation_id):
     contributor = Contributor.objects.get(user=request.user)
-    invitation = get_object_or_404 (RefereeInvitation, pk=invitation_id)
+    invitation = get_object_or_404(RefereeInvitation, pk=invitation_id)
     if request.method == 'POST':
         form = ConsiderRefereeInvitationForm(request.POST)
         if form.is_valid():
@@ -876,7 +1024,6 @@ def accept_or_decline_ref_invitation_ack(request, invitation_id):
     return render(request, 'submissions/accept_or_decline_ref_invitation_ack.html', context)
 
 
-
 @login_required
 @permission_required_or_403('can_take_editorial_actions',
                             (Submission, 'arxiv_identifier_w_vn_nr', 'arxiv_identifier_w_vn_nr'))
@@ -886,8 +1033,8 @@ def cancel_ref_invitation(request, arxiv_identifier_w_vn_nr, invitation_id):
     to remove a referee for the list of invited ones.
     It can be used for registered as well as unregistered referees.
     """
-    invitation = get_object_or_404 (RefereeInvitation, pk=invitation_id)
-    invitation.cancelled=True
+    invitation = get_object_or_404(RefereeInvitation, pk=invitation_id)
+    invitation.cancelled = True
     invitation.save()
     SubmissionUtils.load({'invitation': invitation})
     SubmissionUtils.send_ref_cancellation_email()
@@ -899,7 +1046,7 @@ def cancel_ref_invitation(request, arxiv_identifier_w_vn_nr, invitation_id):
 @permission_required_or_403('can_take_editorial_actions',
                             (Submission, 'arxiv_identifier_w_vn_nr', 'arxiv_identifier_w_vn_nr'))
 def extend_refereeing_deadline(request, arxiv_identifier_w_vn_nr, days):
-    submission = get_object_or_404 (Submission, arxiv_identifier_w_vn_nr=arxiv_identifier_w_vn_nr)
+    submission = get_object_or_404(Submission, arxiv_identifier_w_vn_nr=arxiv_identifier_w_vn_nr)
     submission.reporting_deadline += datetime.timedelta(days=int(days))
     submission.open_for_reporting = True
     submission.open_for_commenting = True
@@ -914,7 +1061,7 @@ def extend_refereeing_deadline(request, arxiv_identifier_w_vn_nr, days):
 @permission_required_or_403('can_take_editorial_actions',
                             (Submission, 'arxiv_identifier_w_vn_nr', 'arxiv_identifier_w_vn_nr'))
 def set_refereeing_deadline(request, arxiv_identifier_w_vn_nr):
-    submission = get_object_or_404 (Submission, arxiv_identifier_w_vn_nr=arxiv_identifier_w_vn_nr)
+    submission = get_object_or_404(Submission, arxiv_identifier_w_vn_nr=arxiv_identifier_w_vn_nr)
     if request.method == 'POST':
         form = SetRefereeingDeadlineForm(request.POST)
         if form.is_valid():
@@ -950,10 +1097,10 @@ def close_refereeing_round(request, arxiv_identifier_w_vn_nr):
     round off any replies to reports or comments before the
     editorial recommendation is formulated.
     """
-    submission = get_object_or_404 (Submission, arxiv_identifier_w_vn_nr=arxiv_identifier_w_vn_nr)
+    submission = get_object_or_404(Submission, arxiv_identifier_w_vn_nr=arxiv_identifier_w_vn_nr)
     submission.open_for_reporting = False
     submission.open_for_commenting = False
-    if submission.status == 'EICassigned': # only close if currently undergoing refereeing
+    if submission.status == 'EICassigned':  # only close if currently undergoing refereeing
         submission.status = 'review_closed'
     submission.reporting_deadline = timezone.now()
     submission.latest_activity = timezone.now()
@@ -968,9 +1115,9 @@ def communication(request, arxiv_identifier_w_vn_nr, comtype, referee_id=None):
     Communication between editor-in-charge, author or referee
     occurring during the submission refereeing.
     """
-    submission = get_object_or_404 (Submission, arxiv_identifier_w_vn_nr=arxiv_identifier_w_vn_nr)
+    submission = get_object_or_404(Submission, arxiv_identifier_w_vn_nr=arxiv_identifier_w_vn_nr)
     errormessage = None
-    if not comtype in ed_comm_choices_dict.keys():
+    if comtype not in ed_comm_choices_dict.keys():
         errormessage = 'Unknown type of cummunication.'
     # TODO: Verify that this is requested by an authorized contributor (eic, ref, author)
     elif (comtype in ['EtoA', 'EtoR', 'EtoS'] and
@@ -1021,37 +1168,36 @@ def communication(request, arxiv_identifier_w_vn_nr, comtype, referee_id=None):
                             (Submission, 'arxiv_identifier_w_vn_nr', 'arxiv_identifier_w_vn_nr'))
 @transaction.atomic
 def eic_recommendation(request, arxiv_identifier_w_vn_nr):
-    submission = get_object_or_404 (Submission, arxiv_identifier_w_vn_nr=arxiv_identifier_w_vn_nr)
+    submission = get_object_or_404(Submission, arxiv_identifier_w_vn_nr=arxiv_identifier_w_vn_nr)
     if submission.status not in ['EICassigned', 'review_closed']:
-        errormessage = ('This submission\'s current status is: '
-                        + submission_status_dict[submission.status] + '. '
+        errormessage = ('This submission\'s current status is: ' +
+                        submission_status_dict[submission.status] + '. '
                         'An Editorial Recommendation is not required.')
         return render(request, 'scipost/error.html', {'errormessage': errormessage})
     if request.method == 'POST':
         form = EICRecommendationForm(request.POST)
         if form.is_valid():
-            #recommendation = form.save()
             recommendation = EICRecommendation(
-                submission = submission,
-                date_submitted = timezone.now(),
-                remarks_for_authors = form.cleaned_data['remarks_for_authors'],
-                requested_changes = form.cleaned_data['requested_changes'],
-                remarks_for_editorial_college = form.cleaned_data['remarks_for_editorial_college'],
-                recommendation = form.cleaned_data['recommendation'],
-                voting_deadline = timezone.now() + datetime.timedelta(days=7),
+                submission=submission,
+                date_submitted=timezone.now(),
+                remarks_for_authors=form.cleaned_data['remarks_for_authors'],
+                requested_changes=form.cleaned_data['requested_changes'],
+                remarks_for_editorial_college=form.cleaned_data['remarks_for_editorial_college'],
+                recommendation=form.cleaned_data['recommendation'],
+                voting_deadline=timezone.now() + datetime.timedelta(days=7),
             )
             recommendation.save()
             # If recommendation is to accept or reject,
             # it is forwarded to the Editorial College for voting
             # If it is to carry out minor or major revisions,
             # it is returned to the Author who is asked to resubmit
-            if (recommendation.recommendation == 1
-                or recommendation.recommendation == 2
-                or recommendation.recommendation == 3
-                or recommendation.recommendation == -3):
+            if (recommendation.recommendation == 1 or
+                    recommendation.recommendation == 2 or
+                    recommendation.recommendation == 3 or
+                    recommendation.recommendation == -3):
                 submission.status = 'voting_in_preparation'
-            elif (recommendation.recommendation == -1
-                  or recommendation.recommendation == -2):
+            elif (recommendation.recommendation == -1 or
+                  recommendation.recommendation == -2):
                 submission.status = 'revision_requested'
                 SubmissionUtils.load({'submission': submission,
                                       'recommendation': recommendation})
@@ -1081,12 +1227,12 @@ def eic_recommendation(request, arxiv_identifier_w_vn_nr):
 @permission_required('scipost.can_referee', raise_exception=True)
 @transaction.atomic
 def submit_report(request, arxiv_identifier_w_vn_nr):
-    submission = get_object_or_404 (Submission, arxiv_identifier_w_vn_nr=arxiv_identifier_w_vn_nr)
+    submission = get_object_or_404(Submission, arxiv_identifier_w_vn_nr=arxiv_identifier_w_vn_nr)
     # Check whether the user can submit a report:
     is_author = request.user.contributor in submission.authors.all()
-    is_author_unchecked = (not is_author
-                           and not (request.user.contributor in submission.authors_false_claims.all())
-                           and (request.user.last_name in submission.author_list))
+    is_author_unchecked = (not is_author and not
+                           (request.user.contributor in submission.authors_false_claims.all()) and
+                           (request.user.last_name in submission.author_list))
     invited = RefereeInvitation.objects.filter(submission=submission,
                                                referee=request.user.contributor).exists()
     errormessage = None
@@ -1115,27 +1261,27 @@ def submit_report(request, arxiv_identifier_w_vn_nr):
             if submission.referees_flagged is not None:
                 if author.user.last_name in submission.referees_flagged:
                     flagged = True
-            newreport = Report (
-                submission = submission,
-                author = author,
-                invited = invited,
-                flagged = flagged,
-                qualification = form.cleaned_data['qualification'],
-                strengths = form.cleaned_data['strengths'],
-                weaknesses = form.cleaned_data['weaknesses'],
-                report = form.cleaned_data['report'],
-                requested_changes = form.cleaned_data['requested_changes'],
-                validity = form.cleaned_data['validity'],
-                significance = form.cleaned_data['significance'],
-                originality = form.cleaned_data['originality'],
-                clarity = form.cleaned_data['clarity'],
-                formatting = form.cleaned_data['formatting'],
-                grammar = form.cleaned_data['grammar'],
-                recommendation = form.cleaned_data['recommendation'],
-                remarks_for_editors = form.cleaned_data['remarks_for_editors'],
-                anonymous = form.cleaned_data['anonymous'],
-                date_submitted = timezone.now(),
-                )
+            newreport = Report(
+                submission=submission,
+                author=author,
+                invited=invited,
+                flagged=flagged,
+                qualification=form.cleaned_data['qualification'],
+                strengths=form.cleaned_data['strengths'],
+                weaknesses=form.cleaned_data['weaknesses'],
+                report=form.cleaned_data['report'],
+                requested_changes=form.cleaned_data['requested_changes'],
+                validity=form.cleaned_data['validity'],
+                significance=form.cleaned_data['significance'],
+                originality=form.cleaned_data['originality'],
+                clarity=form.cleaned_data['clarity'],
+                formatting=form.cleaned_data['formatting'],
+                grammar=form.cleaned_data['grammar'],
+                recommendation=form.cleaned_data['recommendation'],
+                remarks_for_editors=form.cleaned_data['remarks_for_editors'],
+                anonymous=form.cleaned_data['anonymous'],
+                date_submitted=timezone.now(),
+            )
             newreport.save()
             author.nr_reports = Report.objects.filter(author=author).count()
             author.save()
@@ -1146,7 +1292,7 @@ def submit_report(request, arxiv_identifier_w_vn_nr):
 
     else:
         form = ReportForm()
-    context = {'submission': submission, 'form': form }
+    context = {'submission': submission, 'form': form}
     return render(request, 'submissions/submit_report.html', context)
 
 
@@ -1157,7 +1303,7 @@ def vet_submitted_reports(request):
     report_to_vet = Report.objects.filter(status=0,
                                           submission__editor_in_charge=contributor).first()
     form = VetReportForm()
-    context = {'contributor': contributor, 'report_to_vet': report_to_vet, 'form': form }
+    context = {'contributor': contributor, 'report_to_vet': report_to_vet, 'form': form}
     return(render(request, 'submissions/vet_submitted_reports.html', context))
 
 
@@ -1182,11 +1328,9 @@ def vet_submitted_report_ack(request, report_id):
             # email report author
             SubmissionUtils.load({'report': report,
                                   'email_response': form.cleaned_data['email_response_field']})
-            SubmissionUtils.acknowledge_report_email() # email report author, bcc EIC
+            SubmissionUtils.acknowledge_report_email()  # email report author, bcc EIC
             if report.status == 1:
                 SubmissionUtils.send_author_report_received_email()
-    #context = {'submission': report.submission}
-    #return render(request, 'submissions/vet_submitted_report_ack.html', context)
     context = {'ack_header': 'Submitted Report vetted.',
                'followup_message': 'Return to the ',
                'followup_link': reverse('submissions:editorial_page',
@@ -1213,10 +1357,10 @@ def prepare_for_voting(request, rec_id):
             recommendation.eligible_to_vote = eligibility_form.cleaned_data['eligible_Fellows']
             recommendation.voted_for.add(recommendation.submission.editor_in_charge)
             recommendation.save()
-            recommendation.submission.status='put_to_EC_voting'
+            recommendation.submission.status = 'put_to_EC_voting'
             recommendation.submission.save()
-            return render (request, 'scipost/acknowledgement.html',
-                           context={'ack_message': 'We have registered your selection.'})
+            return render(request, 'scipost/acknowledgement.html',
+                          context={'ack_message': 'We have registered your selection.'})
     else:
         # Identify possible co-authorships in last 3 years, disqualifying Fellow from voting:
         if recommendation.submission.metadata is not None:
@@ -1288,18 +1432,18 @@ def fix_College_decision(request, rec_id):
     Called by an Editorial Administrator.
     """
     recommendation = get_object_or_404(EICRecommendation, pk=rec_id)
-    if recommendation.recommendation==1:
+    if recommendation.recommendation == 1:
         # Publish as Tier I (top 10%)
-        recommendation.submission.status='accepted'
-    elif recommendation.recommendation==2:
+        recommendation.submission.status = 'accepted'
+    elif recommendation.recommendation == 2:
         # Publish as Tier II (top 50%)
-        recommendation.submission.status='accepted'
-    elif recommendation.recommendation==3:
+        recommendation.submission.status = 'accepted'
+    elif recommendation.recommendation == 3:
         # Publish as Tier III (meets criteria)
-        recommendation.submission.status='accepted'
-    elif recommendation.recommendation==-3:
+        recommendation.submission.status = 'accepted'
+    elif recommendation.recommendation == -3:
         # Reject
-        recommendation.submission.status='rejected'
+        recommendation.submission.status = 'rejected'
         previous_submissions = Submission.objects.filter(
             arxiv_identifier_wo_vn_nr=recommendation.submission.arxiv_identifier_wo_vn_nr
         ).exclude(pk=recommendation.submission.id)
@@ -1312,5 +1456,5 @@ def fix_College_decision(request, rec_id):
                           'recommendation': recommendation})
     SubmissionUtils.send_author_College_decision_email()
     ack_message = 'The Editorial College\'s decision has been fixed.'
-    return render (request, 'scipost/acknowledgement.html',
-                   context={'ack_message': ack_message})
+    return render(request, 'scipost/acknowledgement.html',
+                  context={'ack_message': ack_message})