diff --git a/VIPSWeb/urls.py b/VIPSWeb/urls.py
index 07f1a92f61f484ae2ecad72b40eebf8c206c2131..ac6830cc697f28b241d25159b33269bb8015df41 100755
--- a/VIPSWeb/urls.py
+++ b/VIPSWeb/urls.py
@@ -32,6 +32,8 @@ js_info_dict = {
     'domain': 'djangojs',
 }
 
+#print "settings.MAINTENANCE_MODE=%s" % settings.MAINTENANCE_MODE
+
 if settings.MAINTENANCE_MODE is True:
     urlpatterns = patterns('',
                            url(r'^$', views.maintenance, name='maintenance')
diff --git a/cerealblotchmodels/static/cerealblotchmodels/formdefinitions/wheatLeafBlotchForm.json b/cerealblotchmodels/static/cerealblotchmodels/formdefinitions/wheatLeafBlotchForm.json
index 32434bb3643864d7f1bbc1eb08694bd5b530a703..75260a0deb3ba04df3cbcc6a92c605c6d9173d57 100755
--- a/cerealblotchmodels/static/cerealblotchmodels/formdefinitions/wheatLeafBlotchForm.json
+++ b/cerealblotchmodels/static/cerealblotchmodels/formdefinitions/wheatLeafBlotchForm.json
@@ -18,6 +18,11 @@
     ],
     "_comment" : "Structure of the observationForm and how to validate it",
     "fields": [
+		{
+            "name" : "cropStadium",
+            "dataType" : "INTEGER",
+            "required" : true
+        },
         {
             "name" : "weatherStationId",
             "dataType" : "INTEGER",
@@ -63,16 +68,41 @@
             "required" : false
         },
         {
-            "name" : "preparationId",
+            "name" : "preparationId1",
+            "dataType" : "INTEGER",
+            "fieldType" : "SELECT_SINGLE",
+            "required" : false,
+            "nullValue" : "-1"
+        },
+        {
+            "name" : "preparationDose1",
+            "dataType" : "DOUBLE",
+            "required" : false
+        },
+        {
+            "name" : "preparationId2",
+            "dataType" : "INTEGER",
+            "fieldType" : "SELECT_SINGLE",
+            "required" : false,
+            "nullValue" : "-1"
+        },
+        {
+            "name" : "preparationDose2",
+            "dataType" : "DOUBLE",
+            "required" : false
+        },
+        {
+            "name" : "preparationId3",
             "dataType" : "INTEGER",
             "fieldType" : "SELECT_SINGLE",
             "required" : false,
             "nullValue" : "-1"
         },
         {
-            "name" : "preparationDose",
+            "name" : "preparationDose3",
             "dataType" : "DOUBLE",
             "required" : false
         }
+        
     ]
 }
diff --git a/cerealblotchmodels/templates/cerealblotchmodels/wheatleafblotchform.html b/cerealblotchmodels/templates/cerealblotchmodels/wheatleafblotchform.html
index 37fe186d31fcc39126e8e97494fc17090141d8d8..b0a031dfb307531b2d45254b5d53411e78868f4d 100755
--- a/cerealblotchmodels/templates/cerealblotchmodels/wheatleafblotchform.html
+++ b/cerealblotchmodels/templates/cerealblotchmodels/wheatleafblotchform.html
@@ -37,6 +37,7 @@
 		de fleste moderne nettlesere, som Chrome, Firefox og Internet Explorer versjon 10 og nyere.
 	</div>
 	<form role="form" id="{{ form_id }}">
+		<input type="hidden" name="wheatType" id="wheatType" value="-1"/>
 		<div class="row">
 			<div class="col-md-12">
 				<h2>{% trans "Background data for the wheat leaf blotch model" %}</h2>
@@ -45,6 +46,11 @@
 		<div class="row">
 			<div class="col-md-6">
 				<input type="hidden" name="timeZone" value="Europe/Oslo"/>
+				<div class="form-group">
+					<label for="cropStadium">{% trans "Growth stage" %}</label>
+            		<input type="number" name="cropStadium"  class="form-control" onblur="validateCropStadium(this.value);"/>
+            		<span class="help-block" id="{{ form_id }}_cropStadium_validation"></span>
+				</div>
 				<div class="form-group">
 					<label for="weatherStationId">{% trans "Weather station" %}</label>
 					<select name="weatherStationId" id="weatherStationId" class="form-control" onblur="validateField(this);">
@@ -72,37 +78,61 @@
 					<label for="plowed"><span>{% trans "Plowed" %}</span></label><br/>
 					<span class="help-block" id="{{ form_id }}_plowed_validation"></span>
 				</div>
-			</div>
-			<div class="col-md-6 form-group">
 				<div class="form-group">
 					<label for="observationDate">{% trans "Observation date" %}</label>
 					<input type="date" name="observationDate" class="form-control"/>
 					<span class="help-block" id="{{ form_id }}_observationDate_validation"></span>
 				</div>
 				<div class="form-group">
-					
 					<label for ="observationValue">{% trans "&#37; Infected leaves" %}</label>
 					<span>(Tell opp antall blad med bladflekksjukdommer på de 4 øverste fullt utviklede blad på hver av 25 planter (4 * 25 = til sammen 100 blader.)</span>
 					<input type="number" name="observationValue" class="form-control" min="0" max="100"/>
 					<span class="help-block" id="{{ form_id }}_observationValue_validation"></span>
 				</div>
-				<div class="form-group">
-					<label for="sprayingDate">{% trans "Spraying date" %}</label>
-					<input type="date" name="sprayingDate" class="form-control"/>
-					<span class="help-block" id="{{ form_id }}_sprayingDate_validation"></span>
-				</div>
-				<div class="form-group">
-					<label for="preparationId">{% trans "Preparation" %}</label>
-					<select name="preparationId" id="preparationId" class="form-control">
-					</select>
-					<span class="help-block" id="{{ form_id }}_preparationId_validation"></span>
-				</div>
-				<div class="form-group">
-					<label for="preparationDose">{% trans "Preparation dose" %} (ml/daa)</label>
-					<input type="number" name="preparationDose" class="form-control"/>
-					<span class="help-block" id="{{ form_id }}_preparationDose_validation"></span>
-				</div>
+			</div>
+			<div class="col-md-6 form-group">
 				
+				<fieldset>
+					<legend>{% trans "Spraying" %}</legend>
+					<div class="form-group">
+						<label for="sprayingDate">{% trans "Spraying date" %}</label>
+						<input type="date" name="sprayingDate" class="form-control"/>
+						<span class="help-block" id="{{ form_id }}_sprayingDate_validation"></span>
+					</div>
+					<div class="form-group">
+						<label for="preparationId1">{% trans "Preparation 1" %}</label>
+						<select name="preparationId1" id="preparationId1" class="form-control">
+						</select>
+						<span class="help-block" id="{{ form_id }}_preparationId1_validation"></span>
+					</div>
+					<div class="form-group">
+						<label for="preparationDose1">{% trans "Preparation dose" %} (ml/daa)</label>
+						<input type="number" name="preparationDose1" class="form-control"/>
+						<span class="help-block" id="{{ form_id }}_preparationDose1_validation"></span>
+					</div>
+					<div class="form-group">
+						<label for="preparationId2">{% trans "Preparation 2" %}</label>
+						<select name="preparationId2" id="preparationId2" class="form-control">
+						</select>
+						<span class="help-block" id="{{ form_id }}_preparationId2_validation"></span>
+					</div>
+					<div class="form-group">
+						<label for="preparationDose2">{% trans "Preparation dose" %} (ml/daa)</label>
+						<input type="number" name="preparationDose2" class="form-control"/>
+						<span class="help-block" id="{{ form_id }}_preparationDose2_validation"></span>
+					</div>
+					<div class="form-group">
+						<label for="preparationId3">{% trans "Preparation 3" %}</label>
+						<select name="preparationId3" id="preparationId3" class="form-control">
+						</select>
+						<span class="help-block" id="{{ form_id }}_preparationId3_validation"></span>
+					</div>
+					<div class="form-group">
+						<label for="preparationDose3">{% trans "Preparation dose" %} (ml/daa)</label>
+						<input type="number" name="preparationDose3" class="form-control"/>
+						<span class="help-block" id="{{ form_id }}_preparationDose3_validation"></span>
+					</div>
+				</fieldset>
 			</div>
 		</div>
 		<div class="row">
@@ -156,17 +186,34 @@
 		}
 		// Spraying: Either no fields or all fields must be set
 		var truthies = (theForm["sprayingDate"].value.trim() == "" ? 1 : 0)
-						+ (theForm["preparationId"].options[theForm["preparationId"].selectedIndex].value == "-1" ? 1 : 0)
-						+ (theForm["preparationDose"].value.trim() == "" ? 1 : 0);
+						+ (theForm["preparationId1"].options[theForm["preparationId1"].selectedIndex].value == "-1" ? 1 : 0)
+						+ (theForm["preparationDose1"].value.trim() == "" ? 1 : 0);
 		if(truthies != 0 && truthies != 3)
 		{
 			alert("{% trans "Missing spraying information" %}");
 			return false;
 		}
+		// Optinally, spraying 2 is also completed
+		truthies = (theForm["preparationId2"].options[theForm["preparationId2"].selectedIndex].value == "-1" ? 1 : 0)
+		+ (theForm["preparationDose2"].value.trim() == "" ? 1 : 0)
+		if(truthies != 0 && truthies != 2)
+		{
+			alert("{% trans "Missing spraying information on second preparation" %}");
+			return false;
+		}
 		return true;
 	}
 
 	
+	function validateCropStadium(cropStadium)
+	{
+		if(parseInt(cropStadium) < 31)
+        {
+            alert("{% trans "Too early to calculate risk" %}");
+        }
+
+	}
+	
 
 	var VIPSOrganizationId = {{vips_organization_id}};
 	function runModel()
@@ -174,12 +221,30 @@
 		document.getElementById("results").style.display="none";
 		document.getElementById("errorMessageContainer").style.display="none";
 		document.getElementById("runningModelMessage").style.display="block";
+		// Setting the wheatType
+		var cropId = document.getElementById("cropOrganismId").options[document.getElementById("cropOrganismId").selectedIndex].value;
+		var currentType = null;
+		for(var i in allWheatVarieties)
+    	{
+    		var crop = allWheatVarieties[i];
+    		var wheatType = getOrganismLocalNameWithFallback(crop.extraProperties.type,"nb","nb");
+    		console.info(wheatType);
+    		if(currentType == null || currentType != wheatType)
+    		{
+    			currentType = wheatType;
+    		}
+    		if(crop.organismId == cropId)
+    		{
+    			document.getElementById("wheatType").value = currentType == "Vårhvete" ? 1 : 2;
+    			break;
+    		}
+    	}
 		// TODO: Validate form
 		// 
 		var formStr = $("#{{ form_id }}").serialize();
 		var request = $.ajax({
 	        type:"GET",
-	        url: settings.vipslogicProtocol + "://" + settings.vipslogicServerName + "/rest/barleynetblotchmodel/runmodel/" + VIPSOrganizationId + "?" + formStr,
+	        url: settings.vipslogicProtocol + "://" + settings.vipslogicServerName + "/rest/wheatleafblotchmodel/runmodel/" + VIPSOrganizationId + "?" + formStr,
 	        statusCode:{
 	            200: renderResults,
 	            400: handleAjaxError,
@@ -192,13 +257,9 @@
 	}
 	
 	var paramDict = {
-		"BARLEYNETB.DG2410" : "DG2410",
 		"WEATHER.TMD": "{% trans "Temperature, daily mean" %}",
-		"WEATHER.RR28" : "{% trans "Rain last 28 days" %}",
-		"WEATHER.RRD" : "{% trans "Rain, daily" %}",
-		"WEATHER.TMDD0C" :"{% trans "Day degrees since sowing" %}",
-		"BARLEYNETB.Y" : "{% trans "Threshold" %}",
-		"BARLEYNETB.X_ADJUSTED" : "{% trans "Disease" %}",
+		"WLEAFBLTCH.THRESHOLD_SUM" : "{% trans "Threshold" %}",
+		"WLEAFBLTCH.DISEASE_SUM" : "{% trans "Disease" %}",
 	};
 	
 	var renderResults = function(data,textStatus, jqXHR)
@@ -208,25 +269,31 @@
 		var headingLine = "<tr><td style=\"font-weight: bold;\">{% trans "Time" %}</td>";
         if(data.length > 0)
         {
-            var allKeys = data[0].keys;
+            var allKeys = JSON.parse(data[0]["keys"]);
             for(var i in allKeys)
             {
-                headingLine +="<td style=\"font-weight: bold;\">" + paramDict[allKeys[i]] + "</td>";
+            	var aKey = allKeys[i];
+            	console.info(aKey);
+                headingLine +="<td style=\"font-weight: bold;\">" + paramDict[aKey] + "</td>";
             }
             headingLine +="<td style=\"font-weight: bold;\">{% trans "Warning status" %}</td>";
             headingLine += "</tr>";
 
             var table = ["<table border=\"1\">",headingLine];
-            for(var row in data)
+            for(var i in data)
             {
-            	if(data[row]["validTimeStart"] == null)
+            	console.info(data[i]);
+               	var aResult = data[i];
+				var allValues = JSON.parse(aResult["allValues"]);
+            	if(aResult["validTimeStart"] == null)
             	{
             		continue;
             	}
-                var resultLine = "<tr><td>" + moment(data[row]["validTimeStart"]).format() + "</td>";
+                var resultLine = "<tr><td>" + moment(aResult["validTimeStart"]).format() + "</td>";
                 for(var i in allKeys)
                 {
-                	var value = data[row].allValues[allKeys[i]];
+                	var value = allValues[allKeys[i]];
+                	console.info(value);
                 	if(value != null && $.isNumeric(value))
                 	{
                 		value = parseFloat(value).toFixed(2);
@@ -234,7 +301,7 @@
                     resultLine +="<td>" + value + "</td>";
                 }
                 resultLine +="<td style=\"background-color:";
-                var st = data[row]["warningStatus"];
+                var st = aResult["warningStatus"];
                 resultLine += st===0 ? "gray" : st===1 ? "blue" : st===2 ? "green" : st===3 ? "yellow" : "red";
                 resultLine +=";\">" + st + "</td>";
                 resultLine += "</tr>";
@@ -262,11 +329,11 @@
         		{"color": "#6600FF", "opposite": false, "abbr": " ", "title": "{% trans "Disease value" %}"}
         	],
         	[
-        		{key: "BARLEYNETB.Y", type: "spline", color: "red", name: "{% trans "Threshold" %}", yAxis: 0},
-        		{key: "BARLEYNETB.X_ADJUSTED", type: "spline", color: "black", name: "{% trans "Disease" %}", yAxis: 0}
+        		{key: "WLEAFBLTCH.THRESHOLD_SUM", type: "spline", color: "orange", name: "{% trans "Threshold" %}", yAxis: 0},
+        		{key: "WLEAFBLTCH.DISEASE_SUM", type: "spline", color: "black", name: "{% trans "Disease" %}", yAxis: 0}
         	]
         );
-        renderForecastChart("chartContainer", "{% trans "Barley net blotch development" %}", warningStatusPlotBandData, data);
+        renderForecastChart("chartContainer", "{% trans "Wheat leaf blotch development" %}", warningStatusPlotBandData, data);
 	};
 	
 	
@@ -295,20 +362,35 @@
 	     });
 	}
 	
+	
+	var allWheatVarieties = null;
+	
 	function initCrops()
     {
      	// Fetching information asynchronously from server 
 	    var request = $.ajax({
 	        type:"GET",
-	        url: settings.vipslogicProtocol + "://" + settings.vipslogicServerName + "/rest/barleynetblotchmodel/barleyvarieties/" + VIPSOrganizationId,
+	        url: settings.vipslogicProtocol + "://" + settings.vipslogicServerName + "/rest/wheatleafblotchmodel/wheatvarieties/" + VIPSOrganizationId,
 	        statusCode:{
 	            200: function(data,textStatus, jqXHR){
 	            	// Building result HTML
 	            	var cropHTML=["<option value=\"-1\">-- {% trans "Select crop" %} --</option>"];
-	            	data.sort(compareOrganisms);
+	            	data.sort(function(a,b){
+	            		var syntheticNameA = getOrganismLocalNameWithFallback(a.extraProperties.type,settings.currentLanguage,settings.defaultLanguage) + "_" + getOrganismLocalNameWithFallback(a,settings.currentLanguage,settings.defaultLanguage);
+	            		var syntheticNameB = getOrganismLocalNameWithFallback(b.extraProperties.type,settings.currentLanguage,settings.defaultLanguage) + "_" + getOrganismLocalNameWithFallback(b,settings.currentLanguage,settings.defaultLanguage);
+	            		return syntheticNameA.localeCompare(syntheticNameB);
+	            	});
+	            	currentType = null;
+	            	allWheatVarieties = data;
 	            	for(var i in data)
 	            	{
 	            		var crop = data[i];
+	            		var wheatType = getOrganismLocalNameWithFallback(crop.extraProperties.type,settings.currentLanguage,settings.defaultLanguage);
+	            		if(currentType == null || currentType != wheatType)
+	            		{
+	            			currentType = wheatType;
+	            			cropHTML.push("<option value=\"-1\">-- " + wheatType + " --</option>");
+	            		}
 	            		
 	            		//console.log(ws);
 	            		cropHTML.push("<option value=\"" + crop["organismId"] + "\">" + getOrganismLocalNameWithFallback(crop,settings.currentLanguage,settings.defaultLanguage) + "</option>");
@@ -328,11 +410,12 @@
     	// Fetching information asynchronously from server 
 	    var request = $.ajax({
 	        type:"GET",
-	        url: settings.vipslogicProtocol + "://" + settings.vipslogicServerName + "/rest/barleynetblotchmodel/preparations/" + VIPSOrganizationId,
+	        url: settings.vipslogicProtocol + "://" + settings.vipslogicServerName + "/rest/wheatleafblotchmodel/preparations/" + VIPSOrganizationId,
 	        statusCode:{
 	            200: function(data,textStatus, jqXHR){
 	            	// Building result HTML
 	            	var preparationHTML=["<option value=\"-1\">-- {% trans "Select preparation" %} --</option>"];
+	            	
 	            	data.sort(comparePreparations);
 	            	for(var i in data)
 	            	{
@@ -340,7 +423,9 @@
 	            		//console.log(ws);
 	            		preparationHTML.push("<option value=\"" + preparation["preparationId"] + "\">" + preparation["preparationName"] + "</option>");
 	            	}
-	            	document.getElementById("preparationId").innerHTML = preparationHTML.join("");
+	            	document.getElementById("preparationId1").innerHTML = preparationHTML.join("");
+	            	document.getElementById("preparationId2").innerHTML = preparationHTML.join("");
+	            	document.getElementById("preparationId3").innerHTML = preparationHTML.join("");
 	        	},
 	            400: handleAjaxError,
 	            401: handleAjaxError,