diff --git a/ippisite/ippidb/forms.py b/ippisite/ippidb/forms.py
index 6f2ef677d658494ccdec43cbc865f6a71780b5f8..031c6d68a9f7e897991020d351de1bfc27136966 100644
--- a/ippisite/ippidb/forms.py
+++ b/ippisite/ippidb/forms.py
@@ -1,10 +1,10 @@
-from django.forms import ModelForm, modelformset_factory, formset_factory
+from django.forms import ModelForm, modelformset_factory, formset_factory, BaseFormSet
 from django import forms
 from django.db import models
 from django.core.exceptions import ValidationError
 from django.core.validators import RegexValidator
 
-from .models import Bibliography, Protein, ProteinDomainComplex, Ppi, PpiComplex, Compound, TestActivityDescription
+from .models import Bibliography, Protein, ProteinDomainComplex, Ppi, PpiComplex, Compound, RefCompoundBiblio, TestActivityDescription
 from .ws import pdb_entry_exists
 
 class IdForm(ModelForm):
@@ -117,6 +117,29 @@ class CompoundForm(ModelForm):
         'common_name': forms.TextInput(attrs={'placeholder':'Choose a common name', 'required': 'required'}),
         }
 
+class RefCompoundBiblioForm(ModelForm):
+    model=RefCompoundBiblio
+    exclude = ['compound', 'bibliography']
+    widgets = {
+        'compound_name': forms.TextInput(attrs={'placeholder':'Compound name in the publication'})
+    }
+
+TYPE_MOLECULE = (
+    ('smiles', 'smiles'),
+    ('iupac', 'iupac'),
+    ('sketch','sketch'),
+)
+
+class BaseCompoundFormSet(BaseFormSet):
+    def add_fields(self, form, index):
+        super(BaseCompoundFormSet, self).add_fields(form, index)
+        form.fields["compound_name"] = forms.CharField(widget=forms.TextInput(attrs={'placeholder':'Compound name in the publication', 'onkeyup':"AnEventHasOccurred(this.id)", 'required':'required'}))
+        form.fields["molecule"] = forms.CharField(widget=forms.RadioSelect(choices=TYPE_MOLECULE, attrs={'onclick':"showMol(this.id)"}))
+        form.fields["molecule_comp"] = forms.CharField()
+
+CompoundFormSet = formset_factory(CompoundForm, formset=BaseCompoundFormSet, extra=2)
+formset = CompoundFormSet()
+
 class ActivityForm(ModelForm):
     
     class Meta:
diff --git a/ippisite/ippidb/static/js/ippidb.js b/ippisite/ippidb/static/js/ippidb.js
index df6776b6f76d32efbf6761f9db22ea44bbe735d3..c353e1c7b2835db38817da57148e422417aaab91 100644
--- a/ippisite/ippidb/static/js/ippidb.js
+++ b/ippisite/ippidb/static/js/ippidb.js
@@ -20,38 +20,45 @@ $("select").change(function(){
 });
 
 // CompoundForm - Update compound name in div
-function AnEventHasOccurred() {
-    console.log("Compound "+ document.getElementById("compound_name").value);
-document.getElementById("compoundName").innerHTML = "Compound "+ document.getElementById("compound_name").value;
+function AnEventHasOccurred(id) {
+    console.log("Compound "+ document.getElementById(id).value);
+document.getElementById("Name_"+id).innerHTML = "Compound "+ document.getElementById(id).value;
 }
 
 
 
 
 // CompoundForm - Function to hide/show input field according to the chosen type of molecule 
-function showSmiles(){
-  document.getElementById('divSmiles').style.display ='block';
-  document.getElementById('divIupac').style.display ='none';
-  document.getElementById('divSketch').style.display ='none';
-  document.getElementById('in-smiles').required=true;
-  document.getElementById('in-sketch').required=false;
-  document.getElementById('in-iupac').required=false;
-}
-function showIupac(){
-    document.getElementById('divSmiles').style.display ='none';
-  document.getElementById('divIupac').style.display ='block';
-  document.getElementById('divSketch').style.display ='none';
-  document.getElementById('in-smiles').required=false;
-  document.getElementById('in-iupac').required=true;
-  document.getElementById('in-sketch').required=false;
-}
-function showSketch(){
-  document.getElementById('divSmiles').style.display ='none';
-  document.getElementById('divIupac').style.display ='none';
-  document.getElementById('divSketch').style.display ='block';
-  document.getElementById('in-smiles').required=false;
-  document.getElementById('in-iupac').required=false;
-  document.getElementById('in-sketch').required=true;
+function showMol(id){
+    if(document.getElementById(id).value=="smiles"){
+        document.getElementById('divSmiles').style.display ='block';
+        document.getElementById('divIupac').style.display ='none';
+        document.getElementById('divSketch').style.display ='none';
+        document.getElementById('in-smiles').required=true;
+        document.getElementById('in-sketch').required=false;
+        document.getElementById('in-iupac').required=false;
+    } else if(document.getElementById(id).value=="iupac"){
+        document.getElementById('divSmiles').style.display ='none';
+        document.getElementById('divIupac').style.display ='block';
+        document.getElementById('divSketch').style.display ='none';
+        document.getElementById('in-smiles').required=false;
+        document.getElementById('in-iupac').required=true;
+        document.getElementById('in-sketch').required=false;
+    } else if (document.getElementById(id).value=="sketch"){
+        document.getElementById('divSmiles').style.display ='none';
+        document.getElementById('divIupac').style.display ='none';
+        document.getElementById('divSketch').style.display ='block';
+        document.getElementById('in-smiles').required=false;
+        document.getElementById('in-iupac').required=false;
+        document.getElementById('in-sketch').required=true;
+    } else {
+        document.getElementById('divSmiles').style.display ='none';
+        document.getElementById('divIupac').style.display ='none';
+        document.getElementById('divSketch').style.display ='none';
+        document.getElementById('in-smiles').required=false;
+        document.getElementById('in-iupac').required=false;
+        document.getElementById('in-sketch').required=false;        
+    }
 }
 
 // Function to enlarge some part of the main page
diff --git a/ippisite/ippidb/templates/CompoundForm.html b/ippisite/ippidb/templates/CompoundForm.html
index 21eba3497857ad394e43bfe373d9c522b123f37e..bff7f766fdf142fa5d0ab5401b3994b3d3ef4ca8 100644
--- a/ippisite/ippidb/templates/CompoundForm.html
+++ b/ippisite/ippidb/templates/CompoundForm.html
@@ -24,6 +24,7 @@
 		<form action="" method="post">
 			{% csrf_token %}
 			<table>
+			{{ formset.management_form }}
 			{{ wizard.management_form }}
 			{{ wizard.form.errors}}
 	    	{{ wizard.form.non_field_errors}}
@@ -31,55 +32,38 @@
 		
 			{% if wizard.form.forms %}
 				{{ wizard.form.management_form }}
+				{{ formset.management_form }}
 				{% for form in wizard.form.forms %}
-				    {{ form }}
-				{% endfor %}
-			{% else %}
 				<div class="compound">
-					<h1 id="compoundName">Compound</h1>
-						<h2>Name your compound</h2>
-						<div class="compound_input">{{ wizard.form.common_name }}</div>
-						<div class="compound_input"><input id="compound_name" name="compound_name" type="text" placeholder="Name in bibliography" required/ onkeyup="AnEventHasOccurred()"></div>
-						<h2>Choose a format to import your molecule</h2>
-						<div id="compound_mol">
-							<div class="compound_radio_smiles">
-								<input type="radio" name="molecule" value="smiles" id="smiles" onclick="showSmiles();" checked="checked">
-								<label for="smiles">
-									<span>SMILES</span>
-								</label>
-							</div>
-							<div class="compound_radio_iupac">
-								<input type="radio" name="molecule" value="iupac" id="iupac" onclick="showIupac();">
-								<label for="iupac">
-									<span>
-										IUPAC
-									</span>
-								</label>
-							</div>
-							<div class="compound_radio_sketch">
-								<input type="radio" name="molecule" value="sketch" id="sketch" onclick="showSketch();">
-								<label for="sketch">
-									<span>
-										Sketch
-									</span>
-								</label>
-							</div>
-						</div>
-						<div id="divSmiles">
-							<input type="text" name="smiles" id="in-smiles" placeholder="Paste the SMILES of your molecule here" required>
-						</div>
-						<div id="divIupac" class="hide">		
-							<input type="text" name="iupac" id="in-iupac" placeholder="Paste the IUPAC of your molecule here">
+					<h1 id="Name_{{ form.compound_name.id_for_label }}">Compound</h1>
+					<h2>Name your compound</h2>
+					<div class="compound_input">{{ form.common_name }}</div>
+					<div class="compound_input">{{ form.compound_name }}</div>
+					<h2>Choose a format to import your molecule</h2>
+					<div id="compound_mol">
+						{% for radio in form.molecule %}
+						<div class="compound_radio_{{ radio.choice_label }}">
+							{{ radio.tag }}
+							<label for="{{ radio.id_for_label }}">
+								<span>{{ radio.choice_label }}</span>
+							</label>
 						</div>
-						<div id="divSketch" class="hide">
-							<input type="text" name="sketch" id="in-sketch" placeholder="Sketch your molecule here">
-						</div>
-						<div id="ck-button-long" class="compound_input">
-						<label>
-					      <input name="is_macrocycle" type="checkbox"><span>{{ wizard.form.is_macrocycle.label }}</span>
-					  </label>
-					  </div>
+						{% endfor %}
+					</div>
+					<div id="divSmiles">
+						<input type="text" name="smiles" id="in-smiles" placeholder="Paste the SMILES of your molecule here" required>
+					</div>
+					<div id="divIupac" class="hide">		
+						<input type="text" name="iupac" id="in-iupac" placeholder="Paste the IUPAC of your molecule here">
+					</div>
+					<div id="divSketch" class="hide">
+						<input type="text" name="sketch" id="in-sketch" placeholder="Sketch your molecule here">
+					</div>
+					<div id="ck-button-long" class="compound_input">
+						<label>{{ form.is_macrocycle}}<span>{{ form.is_macrocycle.label }}</span></label>
+					</div>
 				</div>
+				{% endfor %}
 			{% endif %}
 			</table>
 			<input type="submit" value="{% trans "Next step" %}"/>
diff --git a/ippisite/ippidb/views.py b/ippisite/ippidb/views.py
index 689bc0f97809789611fc483ddf4025020bee4ce4..e62f82c272d3c3ff10084083df887b08f93d95c7 100644
--- a/ippisite/ippidb/views.py
+++ b/ippisite/ippidb/views.py
@@ -4,7 +4,7 @@ from django.shortcuts import render
 from django.http import HttpResponseRedirect, Http404
 from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
 from formtools.wizard.views import SessionWizardView, NamedUrlSessionWizardView
-from .forms import IdForm, BibliographyForm, PDBForm, ProteinForm, ProteinDomainComplexTypeForm, ProteinDomainComplexForm, PpiForm, PpiComplexForm, ProteinFormSet,ActivityForm, CompoundForm
+from .forms import IdForm, BibliographyForm, PDBForm, ProteinForm, ProteinDomainComplexTypeForm, ProteinDomainComplexForm, PpiForm, PpiComplexForm, ProteinFormSet,ActivityForm, CompoundForm, CompoundFormSet
 from .models import Protein, Bibliography, ProteinDomainComplex, RefCompoundBiblio, TestActivityDescription, Compound, Ppi
 from .ws import get_pdb_uniprot_mapping
 
@@ -58,7 +58,7 @@ FORMS = [("IdForm", ippidb.forms.IdForm),
           ippidb.forms.ProteinDomainComplexTypeForm),
          ("ProteinDomainComplexForm", ippidb.forms.ProteinDomainComplexForm),
          ("PpiForm", ippidb.forms.PpiForm),
-         ("CompoundForm", ippidb.forms.CompoundForm),
+         ("CompoundForm", ippidb.forms.CompoundFormSet),
          ("ActivityForm", ippidb.forms.ActivityForm),]
 
 TEMPLATES = {"IdForm": "IdForm.html",