diff --git a/Bachelor_application.iml b/Bachelor_application.iml
index e44eb08e2ddc937de337a2975eda2ef53dc4f301..f8154df5a6a0bb9048b52fc21433f278efd739cf 100644
--- a/Bachelor_application.iml
+++ b/Bachelor_application.iml
@@ -54,37 +54,6 @@
     <orderEntry type="library" name="Maven: com.google.auto.value:auto-value-annotations:1.9" level="project" />
     <orderEntry type="library" name="Maven: org.apache.commons:commons-math3:3.6.1" level="project" />
     <orderEntry type="library" name="Maven: joda-time:joda-time:2.10.14" level="project" />
-    <orderEntry type="library" name="Maven: org.python:jython-slim:2.7.2" level="project" />
-    <orderEntry type="library" name="Maven: org.antlr:antlr:3.5.2" level="project" />
-    <orderEntry type="library" name="Maven: org.antlr:ST4:4.0.8" level="project" />
-    <orderEntry type="library" scope="RUNTIME" name="Maven: javax.servlet:javax.servlet-api:3.1.0" level="project" />
-    <orderEntry type="library" name="Maven: org.antlr:antlr-runtime:3.5.2" level="project" />
-    <orderEntry type="library" scope="RUNTIME" name="Maven: org.apache.commons:commons-compress:1.19" level="project" />
-    <orderEntry type="library" scope="RUNTIME" name="Maven: org.bouncycastle:bcpkix-jdk15on:1.62" level="project" />
-    <orderEntry type="library" scope="RUNTIME" name="Maven: org.bouncycastle:bcprov-jdk15on:1.62" level="project" />
-    <orderEntry type="library" scope="RUNTIME" name="Maven: org.ow2.asm:asm:7.1" level="project" />
-    <orderEntry type="library" scope="RUNTIME" name="Maven: org.ow2.asm:asm-commons:7.1" level="project" />
-    <orderEntry type="library" scope="RUNTIME" name="Maven: org.ow2.asm:asm-tree:7.1" level="project" />
-    <orderEntry type="library" scope="RUNTIME" name="Maven: org.ow2.asm:asm-analysis:7.1" level="project" />
-    <orderEntry type="library" scope="RUNTIME" name="Maven: org.ow2.asm:asm-util:7.1" level="project" />
-    <orderEntry type="library" scope="RUNTIME" name="Maven: com.ibm.icu:icu4j:59.1" level="project" />
-    <orderEntry type="library" scope="RUNTIME" name="Maven: com.carrotsearch:java-sizeof:0.0.5" level="project" />
-    <orderEntry type="library" scope="RUNTIME" name="Maven: com.github.jnr:jffi:1.2.20" level="project" />
-    <orderEntry type="library" scope="RUNTIME" name="Maven: com.github.jnr:jnr-netdb:1.1.6" level="project" />
-    <orderEntry type="library" scope="RUNTIME" name="Maven: com.github.jnr:jnr-ffi:2.1.10" level="project" />
-    <orderEntry type="library" scope="RUNTIME" name="Maven: com.github.jnr:jffi:native:1.2.19" level="project" />
-    <orderEntry type="library" scope="RUNTIME" name="Maven: com.github.jnr:jnr-a64asm:1.0.0" level="project" />
-    <orderEntry type="library" scope="RUNTIME" name="Maven: com.github.jnr:jnr-x86asm:1.0.2" level="project" />
-    <orderEntry type="library" scope="RUNTIME" name="Maven: com.github.jnr:jnr-posix:3.0.50" level="project" />
-    <orderEntry type="library" scope="RUNTIME" name="Maven: com.github.jnr:jnr-constants:0.9.12" level="project" />
-    <orderEntry type="library" scope="RUNTIME" name="Maven: jline:jline:2.14.5" level="project" />
-    <orderEntry type="library" scope="RUNTIME" name="Maven: io.netty:netty-buffer:4.1.45.Final" level="project" />
-    <orderEntry type="library" scope="RUNTIME" name="Maven: io.netty:netty-codec:4.1.45.Final" level="project" />
-    <orderEntry type="library" scope="RUNTIME" name="Maven: io.netty:netty-common:4.1.45.Final" level="project" />
-    <orderEntry type="library" scope="RUNTIME" name="Maven: io.netty:netty-handler:4.1.45.Final" level="project" />
-    <orderEntry type="library" scope="RUNTIME" name="Maven: io.netty:netty-resolver:4.1.45.Final" level="project" />
-    <orderEntry type="library" scope="RUNTIME" name="Maven: io.netty:netty-transport:4.1.45.Final" level="project" />
-    <orderEntry type="library" scope="RUNTIME" name="Maven: org.apache.ant:ant:1.9.7" level="project" />
-    <orderEntry type="library" scope="RUNTIME" name="Maven: org.apache.ant:ant-launcher:1.9.7" level="project" />
+    <orderEntry type="library" name="Maven: org.jblas:jblas:1.2.4" level="project" />
   </component>
 </module>
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 6c3d1d181a6b761cddbf8b2bdfa0624b573f07ad..221d396532975bb209aa47db1d85c44ec971bf1f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -41,9 +41,9 @@
             <version>2.10.14</version>
         </dependency>
         <dependency>
-            <groupId>org.python</groupId>
-            <artifactId>jython-slim</artifactId>
-            <version>2.7.2</version>
+            <groupId>org.jblas</groupId>
+            <artifactId>jblas</artifactId>
+            <version>1.2.4</version>
         </dependency>
     </dependencies>
 
diff --git a/src/main/java/com/application/DB/Constants.java b/src/main/java/com/application/DB/Constants.java
index ff18115d3509932a857bad0b30071e3e3b5f1a58..ed2b28a7a2b93ac7805c5a478d46a44ae0cce66e 100644
--- a/src/main/java/com/application/DB/Constants.java
+++ b/src/main/java/com/application/DB/Constants.java
@@ -16,7 +16,14 @@ public final class Constants {
     }
 
     // Today's date
-    public static final String TODAYS_DATE = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(LocalDateTime.now());
+    public static final String CURRENT_DATE = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(LocalDateTime.now());
+
+    // Start- & end time
+    public static String START_TIME = "";
+    public static String STOP_TIME = "";
+
+    // Boolean variable to tell if the drying process is finished
+    public static boolean IS_FINISHED = false;
 
     // User inputs
     public static String TREE_SPECIES = "";
@@ -24,11 +31,27 @@ public final class Constants {
     public static  String SAWSET = "";
     public static  String MOISTURE_GOAL = "";
 
+    // Number of manual moisture checks
+    public static int NUMBER_OF_CHECKS = 1;
+
     // Number of wanted drying periods
     public static int NUMBER_OF_PERIODS = 1;
 
-    // Database ID/name
+    // Number of seconds to wait before updating live data, in seconds
+    public static int NUMBER_OF_SECONDS_LIVE_DATA = 10;
+
+    // Non linear regression
+    public static final double ADJUST_REGRESSION = 5.5;
+
+    // Current sawmill settings;
     public static final String PROJECT_ID = "sf-drying-optimization";
+    public static final int LOCATION_ID = 124;
+    public static final String MAN_MOISTURE_TABLE = "int_dk_manMoisture";
+    public static final String KWH_TABLE_NAME = "int_sd_winccsensordata";
+    public static final String KWH_NAME_PARAMETER = "VariantValue";
+    public static final String KWH_TIMESTAMP_NAME_PARAMETER  = "Timestamp";
+    public static final String KWH_VALUE_ID_NAME_PARAMETER  = "ValueID";
+    public static final String KWH_VALUE_ID_VALUE_PARAMETER  = "51";          // Which chamber is used
 
 
     // Location Valasen(124)
diff --git a/src/main/java/com/application/DB/DB.java b/src/main/java/com/application/DB/DB.java
index 6b14b5690907b645ed3717a4f11d01a0b26a8e31..3b0936d87144e8e6ed07c3435a08fc418b7e88e7 100644
--- a/src/main/java/com/application/DB/DB.java
+++ b/src/main/java/com/application/DB/DB.java
@@ -158,6 +158,7 @@ public class DB {
 
 
                 // Sets the lowest number of chambers to iterate through
+                assert valmeticsChamberIDS != null;
                 numberOfChambers = Math.min(valmeticsChamberIDS.size(), kwhChamberIDS.size());
 
                 System.out.printf("\nnumberOfChambers: \t%d\n",numberOfChambers);
@@ -267,31 +268,7 @@ public class DB {
 
             //System.out.println("Timestamp \t kWh");
             int baseline = 0;
-            for (FieldValueList row : result.iterateAll()) {
-
-                // Sets the baseline in order to reset the kWh counter
-                if (baseline == 0) {
-                    baseline = row.get("" + KwhName + "").getNumericValue().intValue();
-                }
-                //System.out.println("baseline: "+baseline);
-
-                // kWh value
-                int variantValue = row.get("" + KwhName + "").getNumericValue().intValue() - baseline; //-baseline
-
-                // Retrieving the wanted data
-                long timeStamp = row.get("" + timestamp + "").getTimestampValue() / 1000;
-                // Riktig format, men i string
-                String formatedTimeStamp = HelpingFunctions.getDateFormat().format(timeStamp);
-
-                // Checks for negative values
-                if (variantValue > 0) {
-                    // Adding the data to a list in order to sort through later
-                    data.put(formatedTimeStamp, variantValue);
-                }
-
-                //System.out.printf("Timestamp: \t%s\t\t\tkWh: \t%s\t\t\tBaseline: %s\n",formatedTimeStamp,variantValue,baseline);
-                // Checks if the data is empty
-            }
+            HelpingFunctions.iterateKwhValues(data, baseline, result, KwhName, timestamp);
 
             System.out.println("Data size: " + data.size());
 
@@ -321,10 +298,6 @@ public class DB {
         // Defining a treemap to sort the data incrementally
         NavigableMap<Integer, Map<String, Number>> sortedFinalResults = new TreeMap<>(finalResults);
 
-        for (Map.Entry<String, String> entry : dates.entrySet()) {
-
-        }
-
         for (Map.Entry<Integer, Map<String, Number>> entry : sortedFinalResults.entrySet()) {
 
             Map<String, Number> data = entry.getValue();
@@ -381,7 +354,7 @@ public class DB {
         String extraInputParameter = "";
         extraInputParameter += extraUserInput;
         if(locationID == 124){
-            extraInputParameter += "AND CalculatedStart BETWEEN \"1990-01-01 00:00:00\" AND \"" + TODAYS_DATE + "\" ";
+            extraInputParameter += "AND CalculatedStart BETWEEN \"1990-01-01 00:00:00\" AND \"" + CURRENT_DATE + "\" ";
         }
         if(locationID == 174){
             // KILIN_ID starts at 0 not 1 in the database.
@@ -394,8 +367,8 @@ public class DB {
                         "SELECT MAX("+ nameParameter +") as DryingSchedule, MAX("+kilinName+") as Kiln_ID, " + startDryingTime + ", MAX("+stopDryingTime+") as DryingCompleted " +
                         "FROM `" + PROJECT_ID + "." + locationID + "." + valmeticsTableName + "` " +
                         "WHERE " + kilinName + " = " + kilinID + " " +
-                        "AND "+startDryingTime+" BETWEEN \"1990-01-01 00:00:00\" AND \"" + TODAYS_DATE + "\" " +
-                        "AND "+stopDryingTime+" BETWEEN \"1990-01-01 00:00:00\" AND \"" + TODAYS_DATE + "\" " +
+                        "AND "+startDryingTime+" BETWEEN \"1990-01-01 00:00:00\" AND \"" + CURRENT_DATE + "\" " +
+                        "AND "+stopDryingTime+" BETWEEN \"1990-01-01 00:00:00\" AND \"" + CURRENT_DATE + "\" " +
                                 extraInputParameter +
                         "AND LOWER(" +nameParameter+ ") NOT LIKE LOWER("+'"'+"%"+ "test" +"%"+'"'+") " +
                         "Group by "+ startDryingTime + " " +
@@ -511,6 +484,7 @@ public class DB {
             formatedUtTidTorkPlussDays = addedDays.plusDays(ARJANG_NR_ADDED_DAYS).toString();
             formatedUtTidTorkPlussDays = formatedUtTidTorkPlussDays.split("T")[0];
 
+            /*
             if (locationID == ARJANG_LOCATION_ID) {
 
                 // Sqlstatement
@@ -543,8 +517,12 @@ public class DB {
                 if(!moistureMeasured.isEmpty()){
                     manMoistData.put(formatedUtTidTork,moistureMeasured);
                 }
+
+
             }
 
+             */
+
 
 
 
@@ -580,4 +558,51 @@ public class DB {
         // Returns a treemap that sorts the dates incrementally
         return new TreeMap<>(sortedFinalResults);
     }
+
+
+    public static void pushManMoisture(String moisture, boolean finished) throws Exception {
+        // Sqlstatement
+        final String sqlStatement =
+                "INSERT INTO " + PROJECT_ID + "." + LOCATION_ID + "." + MAN_MOISTURE_TABLE + "(moisture,tree_species,dimensions,sawset,moisture_goal,no_moisture_checkstart_time,start_time,stop_time,finished) " +
+                        "VALUES("+moisture+","+TREE_SPECIES+","+DIMENSIONS+","+SAWSET+","+MOISTURE_GOAL+","+NUMBER_OF_CHECKS+","+",) ";
+
+        System.out.println(sqlStatement);
+
+        HelpingFunctions.createQueryJob(sqlStatement);
+    }
+
+    /**
+     *  Retrieves data from current drying process
+     *
+     * @return a map consisting of Timestamp(date&time) and Kwh value
+     * @throws Exception throws execution if anything is wrong
+     */
+    public static Map<String, Number> getCurrentDrying() throws Exception {
+
+        // Initializing the data map to store the results
+        Map<String, Number> data = new HashMap<>();
+        // Initializing baseline
+        int baseline = 0;
+
+        // Sqlstatement
+        final String sqlStatement = "SELECT `" + KWH_TIMESTAMP_NAME_PARAMETER + "`, `" + KWH_NAME_PARAMETER + "` " +
+                "FROM `" + PROJECT_ID + "." + LOCATION_ID + "." + KWH_TABLE_NAME + "` " +
+                "WHERE " + KWH_TIMESTAMP_NAME_PARAMETER + " BETWEEN " + '"' + START_TIME + '"' +
+                " AND " + '"' + STOP_TIME + '"' +
+                " AND " + KWH_VALUE_ID_NAME_PARAMETER + " = " + KWH_VALUE_ID_VALUE_PARAMETER + " " +
+                " AND " + KWH_NAME_PARAMETER + " <> 0 " +
+                " ORDER BY " + KWH_TIMESTAMP_NAME_PARAMETER + " ASC";
+
+        System.out.println(sqlStatement);
+
+        // Retrieves the results from the queryjob
+        TableResult result = HelpingFunctions.createQueryJob(sqlStatement);
+
+        //System.out.println("InTidTork\t\t\tUtTidTork");
+        // Iterating through the results
+        HelpingFunctions.iterateKwhValues(data, baseline, result, KWH_NAME_PARAMETER, KWH_TIMESTAMP_NAME_PARAMETER);
+        return new TreeMap<>(data);
+    }
+
+
 }
diff --git a/src/main/java/com/application/DB/HelpingFunctions.java b/src/main/java/com/application/DB/HelpingFunctions.java
index 5467ca7743cfd3294e3a80c72138495faffd3658..a34f4f536e07e53e75938bc46c990806a5fa6995 100644
--- a/src/main/java/com/application/DB/HelpingFunctions.java
+++ b/src/main/java/com/application/DB/HelpingFunctions.java
@@ -117,4 +117,36 @@ public class HelpingFunctions {
     public static Map<String, String> getManMoist() {
         return manMoist;
     }
+
+    /**
+     * Function to iterate through all the Kwh values and storing them in a map
+     *
+     * @param data a map to store all the data
+     * @param baseline a baseline to base all the next values of to get a zero point
+     * @param result TableResult to iterate through
+     * @param kwhNameParameter Name of the Kwh name parameter in the database
+     * @param kwhTimestampNameParameter Name of the timestamp parameter in the database
+     */
+    static void iterateKwhValues(Map<String, Number> data, int baseline, TableResult result, String kwhNameParameter, String kwhTimestampNameParameter) {
+        for (FieldValueList row : result.iterateAll()) {
+            // Sets the baseline in order to reset the kWh counter
+            if (baseline == 0) {
+                baseline = row.get("" + kwhNameParameter + "").getNumericValue().intValue();
+            }
+
+            // kWh value
+            int variantValue = row.get("" + kwhNameParameter + "").getNumericValue().intValue() - baseline; //-baseline
+
+            // Retrieving the wanted data
+            long timeStamp = row.get("" + kwhTimestampNameParameter + "").getTimestampValue() / 1000;
+            // Riktig format, men i string
+            String formatedTimeStamp = getDateFormat().format(timeStamp);
+
+            // Checks for negative values
+            if (variantValue > 0) {
+                // Adding the data to a list in order to sort through later
+                data.put(formatedTimeStamp, variantValue);
+            }
+        }
+    }
 }
diff --git a/src/main/java/com/application/GUI/InputPopUpWindow.java b/src/main/java/com/application/GUI/InputPopUpWindow.java
index 22c1947cbbd5bc239cae9ec21140111470c78e67..3043841d2e149601c4bd11ad10ac7972ea495763 100644
--- a/src/main/java/com/application/GUI/InputPopUpWindow.java
+++ b/src/main/java/com/application/GUI/InputPopUpWindow.java
@@ -9,10 +9,13 @@ import javafx.scene.control.*;
 import javafx.scene.layout.*;
 import javafx.stage.*;
 
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
 import java.util.Map;
-import java.util.concurrent.atomic.AtomicBoolean;
 
 import static com.application.DB.Constants.*;
+import static com.application.DB.DB.getCurrentDrying;
+import static com.application.GUI.LineChartFunctionality.loadLiveData;
 import static com.application.Main.*;
 import static com.application.DB.DB.setInputParameters;
 import static com.application.GUI.LineChartFunctionality.loadSingleSeries;
@@ -26,18 +29,7 @@ import static com.application.GUI.LineChartFunctionality.loadSingleSeries;
  */
 public class InputPopUpWindow {
 
-    private static Thread dataThread;
-
-    public static Thread getDataThread(){
-        return dataThread;
-    }
-
-    public static void setDataThread(Thread dataThread) {
-        InputPopUpWindow.dataThread = dataThread;
-    }
-
     public static void exitDataThread(){
-        InputPopUpWindow.dataThread.interrupt();
         Platform.exit();
         System.exit(0);
     }
@@ -125,6 +117,11 @@ public class InputPopUpWindow {
         startButton.setId("inputButtonStart");
 
         startButton.setOnAction(e -> {
+
+                    // Sets the start time
+
+                    START_TIME = CURRENT_DATE;
+
                     // Retrieves the user inputs
                     TREE_SPECIES = treeSpeciesList.getValue();
                     DIMENSIONS = dimensionsList.getValue();
@@ -227,8 +224,9 @@ public class InputPopUpWindow {
  */
 
                     // Fungerende ny thread!!@@@@@
+                    // Gather data
                     try{
-                        setDataThread(new Thread(() -> {
+                        Thread thread = new Thread(() -> {
 
                                 try {
                                     // Henter her data fra databasen
@@ -244,14 +242,44 @@ public class InputPopUpWindow {
                                     ex.printStackTrace();
                                 }
                             }
-                        ));
-                        InputPopUpWindow.dataThread.interrupt();
-                        getDataThread().setDaemon(true);
-                        getDataThread().start();
+                        );
+                        thread.setDaemon(true);
+                        thread.start();
 
                     } catch (Exception ex) {
                         ex.printStackTrace();
                     }
+
+                    // Retrieve data for current drying period
+                        try{
+                            Thread thread = new Thread(() -> {
+                                try {
+                                    while(!IS_FINISHED){
+
+                                        STOP_TIME = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(LocalDateTime.now());
+                                        Map<String, Number> data = getCurrentDrying();
+                                        Platform.runLater(() -> {
+                                            try {
+                                                loadLiveData(data);
+                                            } catch (Exception ex) {
+                                                ex.printStackTrace();
+                                            }
+                                        });
+                                        Thread.sleep(1000L *NUMBER_OF_SECONDS_LIVE_DATA);
+                                    }
+                                } catch (Exception ex) {
+                                    ex.printStackTrace();
+                                }
+                            }
+                            );
+                            thread.setDaemon(true);
+                            thread.start();
+
+                        } catch (Exception ex) {
+                            ex.printStackTrace();
+                        }
+
+
                 }
 
         );
diff --git a/src/main/java/com/application/GUI/LineChartFunctionality.java b/src/main/java/com/application/GUI/LineChartFunctionality.java
index 0bc011d3ceabfde64ec794211be23dc89270df61..c5b42259e1085cbe135eb933243c8e890cfdf2a3 100644
--- a/src/main/java/com/application/GUI/LineChartFunctionality.java
+++ b/src/main/java/com/application/GUI/LineChartFunctionality.java
@@ -1,5 +1,6 @@
 package com.application.GUI;
 
+import javafx.collections.ObservableList;
 import javafx.scene.chart.CategoryAxis;
 import javafx.scene.chart.LineChart;
 import javafx.scene.chart.NumberAxis;
@@ -9,19 +10,24 @@ import org.apache.commons.math3.distribution.TDistribution;
 import org.apache.commons.math3.exception.MathIllegalArgumentException;
 import org.apache.commons.math3.stat.descriptive.SummaryStatistics;
 import org.apache.commons.math3.stat.regression.SimpleRegression;
-import org.python.util.PythonInterpreter;
 
+import java.lang.reflect.Array;
 import java.util.*;
 
+import static com.application.DB.Constants.ADJUST_REGRESSION;
+//import static com.application.DB.DB.
+
 public class LineChartFunctionality {
 
     private static LineChart<String, Number> lineChart;
+    private static XYChart.Series<String, Number> liveDataSeries;
     private static CategoryAxis xAxis;
     private static NumberAxis yAxis;
     private static final double CONFIDENCE_INTERVAL = 0.90;
 
 
     public LineChartFunctionality() {
+        liveDataSeries = new XYChart.Series<String, Number>();
         xAxis = new CategoryAxis();
         yAxis = new NumberAxis();
         lineChart = new LineChart<>(xAxis, yAxis);
@@ -30,11 +36,9 @@ public class LineChartFunctionality {
         yAxis.setLabel("Kwh");
         yAxis.setAnimated(false);
         lineChart.setTitle("Drying Processes");
+        lineChart.getData().add(liveDataSeries);
     }
 
-    public static void setLineChart(LineChart<String, Number> lineChart) {
-        LineChartFunctionality.lineChart = lineChart;
-    }
 
     public static LineChart<String, Number> getLineChart() {
         return lineChart;
@@ -42,6 +46,8 @@ public class LineChartFunctionality {
 
     public static void updateLineChart(XYChart.Series<String, Number> series) {
         lineChart.getData().add(series);
+        series.getNode().setId("dataGraphs");
+        lineChart.getStylesheets().add(LineChartFunctionality.class.getResource("/com.application/GUI/graphStyles.css").toExternalForm());
     }
 
     public static void clearLineChart() {
@@ -117,7 +123,7 @@ public class LineChartFunctionality {
                 index++;
             }
             //allSeries.add(newSeries);
-            updateLineChart(newSeries);
+            //updateLineChart(newSeries);
             //lineChart.setOpacity(1);
         }
 
@@ -126,6 +132,8 @@ public class LineChartFunctionality {
         // Stores the data from the confidence interval in a new map
         Map<Integer, ArrayList<Double>> confidenceIntervalData = statistics(multiMap);
 
+        //getNonLinearRegression(confidenceIntervalData);
+
         // Checks the max size for the arraylists needed for the data array later
         int jMaxSize = 0;
         for (int i = 0; i < confidenceIntervalData.size(); i++) {
@@ -149,25 +157,6 @@ public class LineChartFunctionality {
                 data[index][1] = list.get(j);
                 index++;
             }
-
-            /*
-            for (int j = 0; j < data[i].length; j++) {
-                System.out.println("data[i][j]: "+data[i][j]);
-                if(data[i][j] == 0.0){
-                    double sum = 0.0;
-                    double index = 0.0;
-                    for (int k = 0; k < list.size(); k++) {
-                        if(data[i][k] != 0.0){
-                            sum += data[i][k];
-                            index += 1;
-                        }
-                    }
-                    System.out.println("sum/index: "+ sum/index);
-                    data[i][j] = sum/index;
-                }
-            }
-
-             */
         }
 
 
@@ -181,28 +170,78 @@ public class LineChartFunctionality {
 
 
         for (double[] datum : data) {
+            //System.out.println("");
             for (double v : datum) {
                 //System.out.println("Data: "+v);
             }
         }
 
-        PythonInterpreter pythonInterpreter = new PythonInterpreter();
-        //pythonInterpreter
+        // Finds the end datapoint at the end of each graph
+        int numberOfGraphs = 0;
+        ArrayList<Integer> endOfGraphPoints = new ArrayList<>();
+        for (int i = 0; i < confidenceIntervalData.size(); i++) {
+            ArrayList<Double> list = confidenceIntervalData.get(i);
+            for (int j = 0; j < list.size(); j++) {
+                if (numberOfGraphs < list.size()) {
+                    numberOfGraphs = list.size();
+                }
+                if (list.size() < numberOfGraphs) {
+                    endOfGraphPoints.add(i);
+                    numberOfGraphs = list.size();
+                }
+            }
+        }
+        endOfGraphPoints.add(confidenceIntervalData.size());
+
+        int dataPoints = 0;
+        for (int i = 0; i < endOfGraphPoints.size(); i++) {
+            dataPoints+=endOfGraphPoints.get(i);
+        }
+        dataPoints = dataPoints/endOfGraphPoints.size();
+
+
 
 
 
         XYChart.Series<String, Number> regressionSeries = new XYChart.Series<String, Number>();
-        for (int i = 0; i < confidenceIntervalData.size(); i++) {
+        for (int i = 0; i <= dataPoints; i++) {
 
             // Connect the data to a series
             //System.out.println(simpleRegression.predict(i));
-            regressionSeries.getData().add(new XYChart.Data<String, Number>(String.valueOf(i), simpleRegression.predict(i)));
+            //regressionSeries.getData().add(new XYChart.Data<String, Number>(String.valueOf(i), simpleRegression.predict(i)));
+            regressionSeries.getData().add(new XYChart.Data<String, Number>(
+                            String.valueOf(i),
+                            getNonLinearRegression(confidenceIntervalData,
+                            simpleRegression.getIntercept(),
+                            simpleRegression.getSlope(),
+                            i,
+                            dataPoints)));
         }
-        //updateLineChart(regressionSeries);
+        updateLineChart(regressionSeries);
         //lineChart.setOpacity(1);
 
 
 
+        for (Map.Entry<Integer, Map<String, Number>> entryKwh : userInput.entrySet()) {
+            //System.out.println(data.size());
+            XYChart.Series<String, Number> newSeries = new XYChart.Series<String, Number>();
+            index = 0;
+            for (Object entryData : entryKwh.getValue().entrySet()) {
+                //System.out.println("data: \t"+entryData);
+                String entryString = entryData.toString();
+                Double kwhValue = Double.parseDouble(entryString.split("=")[1]);
+
+                // Connect the data to a series
+                newSeries.getData().add(new XYChart.Data<String, Number>(String.valueOf(index), kwhValue));
+                index++;
+            }
+            //allSeries.add(newSeries);
+            updateLineChart(newSeries);
+            //lineChart.setOpacity(1);
+        }
+
+
+
 
         System.out.println("Get R: " + simpleRegression.getR());
         System.out.println("Get getRSquare: " + simpleRegression.getRSquare());
@@ -221,4 +260,50 @@ public class LineChartFunctionality {
 
         return getLineChart();
     }
+
+    public static void loadLiveData(Map<String, Number> userInput) throws Exception {
+
+        int index = 0;
+        for (Map.Entry<String, Number> entryKwh : userInput.entrySet()) {
+            Double kwhValue = entryKwh.getValue().doubleValue();
+            // Connect the data to a series
+
+            liveDataSeries.getData().add(new XYChart.Data<String, Number>(String.valueOf(index), kwhValue));
+            index++;
+        }
+}
+
+
+    public static double getNonLinearRegression(Map<Integer, ArrayList<Double>> confidenceIntervalData, double y0, double alpha, double j, int n) {
+        //return Math.exp(intercept+slope*i)/(1+Math.exp(intercept+slope*i));
+
+
+        double beta = 0.0;
+        //double n = confidenceIntervalData.size();
+        for (Map.Entry<Integer, ArrayList<Double>> entry : confidenceIntervalData.entrySet()) {
+            for (int i = 0; i < entry.getValue().size(); i++) {
+                if(beta < entry.getValue().get(i)){
+                    beta = entry.getValue().get(i);
+                }
+            }
+        }
+        //System.out.println("maxYValue: " + maxYValue);
+        //System.out.println("j*n: "+j/n);
+
+        //double p_t = ((beta*maxYValue)/(maxYValue+((beta-maxYValue)*Math.exp(-alpha*(yValue-maxYValue)))));
+        //double p_t = ((beta* y0)/(y0 +((beta- y0)*Math.exp(-alpha*j/n/(2*Math.PI)))))-y0;      //Funker sånn halveis
+        //double p_t = (beta * y0)/(y0 + (beta - y0)*Math.exp(-intercept*(j/n)));
+
+        double p_t = (((beta * y0))/(y0 +((beta- y0)*Math.exp(-alpha*j/n/(ADJUST_REGRESSION)))))-y0;      //Beste til nå
+
+
+        System.out.println("---------------------------");
+        System.out.println("y0: " + y0);
+        System.out.println("Alpha: " + alpha);
+        System.out.println("Beta: " + beta);
+        System.out.println(p_t);
+
+        return p_t;
+
+    }
 }
diff --git a/src/main/java/com/application/GUI/OutputPopUpWindow.java b/src/main/java/com/application/GUI/OutputPopUpWindow.java
index 7b651c7d1c8a567d32b66e0d3a6f61f55b6f6d63..94d7d93cae131313a583194d6286a8fa38104ffb 100644
--- a/src/main/java/com/application/GUI/OutputPopUpWindow.java
+++ b/src/main/java/com/application/GUI/OutputPopUpWindow.java
@@ -1,15 +1,20 @@
 package com.application.GUI;
 
+import com.application.DB.DB;
 import javafx.geometry.Pos;
 import javafx.scene.Scene;
 import javafx.scene.control.Button;
 import javafx.scene.control.Label;
 import javafx.scene.control.TextField;
-import javafx.scene.layout.GridPane;
 import javafx.scene.layout.VBox;
 import javafx.stage.Modality;
 import javafx.stage.Stage;
 
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+
+import static com.application.DB.Constants.*;
+
 public class OutputPopUpWindow {
 
     public static void displayOutputWindow(){
@@ -35,9 +40,26 @@ public class OutputPopUpWindow {
         Button countinueButton = new Button("Continue");
         countinueButton.setId("inputButtonStart");
         countinueButton.setAlignment(Pos.BOTTOM_CENTER);
+        countinueButton.setOnAction(e -> {
+                    try {
+                        STOP_TIME = "";
+                        DB.pushManMoisture(moistureCheckTextField.getCharacters().toString(), false);
+                        NUMBER_OF_CHECKS++;
+                    } catch (Exception ex) {
+                        ex.printStackTrace();
+                    }
+                });
         Button finishButton = new Button("Finish");
         finishButton.setId("inputButtonStart");
         finishButton.setAlignment(Pos.BOTTOM_CENTER);
+        finishButton.setOnAction(e -> {
+            try {
+                STOP_TIME = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(LocalDateTime.now());
+                DB.pushManMoisture(moistureCheckTextField.getCharacters().toString(),true);
+            } catch (Exception ex) {
+                ex.printStackTrace();
+            }
+        });
 
 
         VBox layout = new VBox(10);
diff --git a/src/main/resources/com.application/GUI/graphStyles.css b/src/main/resources/com.application/GUI/graphStyles.css
new file mode 100644
index 0000000000000000000000000000000000000000..bbef3d52ce4941ae4c58f31aa59e4f0e8b31486e
--- /dev/null
+++ b/src/main/resources/com.application/GUI/graphStyles.css
@@ -0,0 +1,23 @@
+
+.chart-series-line {
+    -fx-stroke-width: 7px;
+    -fx-effect: null;
+}
+
+.default-color0.chart-series-line{-fx-stroke: green; -fx-opacity: 1.0}
+.default-color1.chart-series-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
+.default-color2.chart-series-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
+.default-color3.chart-series-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
+.default-color4.chart-series-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
+.default-color5.chart-series-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
+.default-color6.chart-series-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
+.default-color7.chart-series-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
+
+.default-color0.chart-line-symbol{-fx-background-color: green,green;}
+.default-color1.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),rgba(0,168,355,0.3);}
+.default-color2.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),rgba(0,168,355,0.3);}
+.default-color3.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),rgba(0,168,355,0.3);}
+.default-color4.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),rgba(0,168,355,0.3);}
+.default-color5.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),rgba(0,168,355,0.3);}
+.default-color6.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),rgba(0,168,355,0.3);}
+.default-color7.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),rgba(0,168,355,0.3);}
diff --git a/src/main/resources/com.application/GUI/graphical_user_interface.fxml b/src/main/resources/com.application/GUI/graphical_user_interface.fxml
deleted file mode 100644
index 4d8f5c57661d0a3add54e8c0ee84bb5649706afc..0000000000000000000000000000000000000000
--- a/src/main/resources/com.application/GUI/graphical_user_interface.fxml
+++ /dev/null
@@ -1,96 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<?import javafx.scene.chart.CategoryAxis?>
-<?import javafx.scene.chart.LineChart?>
-<?import javafx.scene.chart.NumberAxis?>
-<?import javafx.scene.control.Button?>
-<?import javafx.scene.control.Label?>
-<?import javafx.scene.control.Menu?>
-<?import javafx.scene.control.MenuBar?>
-<?import javafx.scene.control.MenuItem?>
-<?import javafx.scene.control.TextField?>
-<?import javafx.scene.image.Image?>
-<?import javafx.scene.image.ImageView?>
-<?import javafx.scene.layout.AnchorPane?>
-<?import javafx.scene.layout.BorderPane?>
-<?import javafx.scene.layout.VBox?>
-<?import javafx.scene.text.Font?>
-
-<BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="700.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1">
-   <left>
-      <VBox prefHeight="200.0" prefWidth="150.0" BorderPane.alignment="CENTER">
-         <children>
-            <Label prefHeight="17.0" prefWidth="150.0" text="Tree Species" />
-            <TextField />
-            <Label prefHeight="17.0" prefWidth="150.0" text="Width x Height" />
-            <TextField />
-            <Label prefHeight="17.0" prefWidth="150.0" text="Sawsett" />
-            <TextField />
-            <Label prefHeight="17.0" prefWidth="150.0" text="Desired moisture level" />
-            <TextField />
-            <Button mnemonicParsing="false" prefHeight="25.0" prefWidth="150.0" text="Finish" />
-         </children>
-      </VBox>
-   </left>
-   <center>
-      <LineChart BorderPane.alignment="CENTER">
-        <xAxis>
-          <CategoryAxis label="Time" side="BOTTOM" />
-        </xAxis>
-        <yAxis>
-          <NumberAxis label="Kwh" side="LEFT" upperBound="25000.0">
-               <tickLabelFont>
-                  <Font name="Arial" size="10.0" />
-               </tickLabelFont>
-            </NumberAxis>
-        </yAxis>
-      </LineChart>
-   </center>
-   <top>
-      <BorderPane prefHeight="80.0" prefWidth="700.0" BorderPane.alignment="CENTER">
-         <center>
-            <AnchorPane prefHeight="78.0" prefWidth="700.0" style="-fx-background-color: rgba(12, 76, 81, 1);" BorderPane.alignment="CENTER">
-               <children>
-                  <BorderPane prefHeight="50.0" prefWidth="700.0">
-                     <left>
-                        <ImageView fitHeight="50.0" fitWidth="50.0" pickOnBounds="true" preserveRatio="true" translateX="5.0" BorderPane.alignment="CENTER">
-                           <image>
-                               <Image url="@moelven_logo_m.png" />
-                           </image>
-                        </ImageView>
-                     </left>
-                     <center>
-                        <ImageView fitHeight="30.0" fitWidth="125.0" pickOnBounds="true" preserveRatio="true">
-                           <image>
-                              <Image url="@moelven_logo_title.png" />
-                           </image>
-                        </ImageView>
-                     </center>
-                  </BorderPane>
-               </children>
-            </AnchorPane>
-         </center>
-         <top>
-            <MenuBar prefHeight="25.0" prefWidth="700.0" BorderPane.alignment="CENTER">
-              <menus>
-                <Menu mnemonicParsing="false" text="File">
-                  <items>
-                    <MenuItem mnemonicParsing="false" text="Close" />
-                  </items>
-                </Menu>
-                <Menu mnemonicParsing="false" text="Edit">
-                  <items>
-                    <MenuItem mnemonicParsing="false" text="Delete" />
-                  </items>
-                </Menu>
-                <Menu mnemonicParsing="false" text="Help">
-                  <items>
-                    <MenuItem mnemonicParsing="false" text="About" />
-                  </items>
-                </Menu>
-              </menus>
-            </MenuBar>
-         </top>
-      </BorderPane>
-   </top>
-</BorderPane>
diff --git a/target/classes/com.application/GUI/graphStyles.css b/target/classes/com.application/GUI/graphStyles.css
new file mode 100644
index 0000000000000000000000000000000000000000..bbef3d52ce4941ae4c58f31aa59e4f0e8b31486e
--- /dev/null
+++ b/target/classes/com.application/GUI/graphStyles.css
@@ -0,0 +1,23 @@
+
+.chart-series-line {
+    -fx-stroke-width: 7px;
+    -fx-effect: null;
+}
+
+.default-color0.chart-series-line{-fx-stroke: green; -fx-opacity: 1.0}
+.default-color1.chart-series-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
+.default-color2.chart-series-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
+.default-color3.chart-series-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
+.default-color4.chart-series-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
+.default-color5.chart-series-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
+.default-color6.chart-series-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
+.default-color7.chart-series-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
+
+.default-color0.chart-line-symbol{-fx-background-color: green,green;}
+.default-color1.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),rgba(0,168,355,0.3);}
+.default-color2.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),rgba(0,168,355,0.3);}
+.default-color3.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),rgba(0,168,355,0.3);}
+.default-color4.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),rgba(0,168,355,0.3);}
+.default-color5.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),rgba(0,168,355,0.3);}
+.default-color6.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),rgba(0,168,355,0.3);}
+.default-color7.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),rgba(0,168,355,0.3);}
diff --git a/target/classes/com.application/GUI/graphical_user_interface.fxml b/target/classes/com.application/GUI/graphical_user_interface.fxml
deleted file mode 100644
index 4d8f5c57661d0a3add54e8c0ee84bb5649706afc..0000000000000000000000000000000000000000
--- a/target/classes/com.application/GUI/graphical_user_interface.fxml
+++ /dev/null
@@ -1,96 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<?import javafx.scene.chart.CategoryAxis?>
-<?import javafx.scene.chart.LineChart?>
-<?import javafx.scene.chart.NumberAxis?>
-<?import javafx.scene.control.Button?>
-<?import javafx.scene.control.Label?>
-<?import javafx.scene.control.Menu?>
-<?import javafx.scene.control.MenuBar?>
-<?import javafx.scene.control.MenuItem?>
-<?import javafx.scene.control.TextField?>
-<?import javafx.scene.image.Image?>
-<?import javafx.scene.image.ImageView?>
-<?import javafx.scene.layout.AnchorPane?>
-<?import javafx.scene.layout.BorderPane?>
-<?import javafx.scene.layout.VBox?>
-<?import javafx.scene.text.Font?>
-
-<BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="700.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1">
-   <left>
-      <VBox prefHeight="200.0" prefWidth="150.0" BorderPane.alignment="CENTER">
-         <children>
-            <Label prefHeight="17.0" prefWidth="150.0" text="Tree Species" />
-            <TextField />
-            <Label prefHeight="17.0" prefWidth="150.0" text="Width x Height" />
-            <TextField />
-            <Label prefHeight="17.0" prefWidth="150.0" text="Sawsett" />
-            <TextField />
-            <Label prefHeight="17.0" prefWidth="150.0" text="Desired moisture level" />
-            <TextField />
-            <Button mnemonicParsing="false" prefHeight="25.0" prefWidth="150.0" text="Finish" />
-         </children>
-      </VBox>
-   </left>
-   <center>
-      <LineChart BorderPane.alignment="CENTER">
-        <xAxis>
-          <CategoryAxis label="Time" side="BOTTOM" />
-        </xAxis>
-        <yAxis>
-          <NumberAxis label="Kwh" side="LEFT" upperBound="25000.0">
-               <tickLabelFont>
-                  <Font name="Arial" size="10.0" />
-               </tickLabelFont>
-            </NumberAxis>
-        </yAxis>
-      </LineChart>
-   </center>
-   <top>
-      <BorderPane prefHeight="80.0" prefWidth="700.0" BorderPane.alignment="CENTER">
-         <center>
-            <AnchorPane prefHeight="78.0" prefWidth="700.0" style="-fx-background-color: rgba(12, 76, 81, 1);" BorderPane.alignment="CENTER">
-               <children>
-                  <BorderPane prefHeight="50.0" prefWidth="700.0">
-                     <left>
-                        <ImageView fitHeight="50.0" fitWidth="50.0" pickOnBounds="true" preserveRatio="true" translateX="5.0" BorderPane.alignment="CENTER">
-                           <image>
-                               <Image url="@moelven_logo_m.png" />
-                           </image>
-                        </ImageView>
-                     </left>
-                     <center>
-                        <ImageView fitHeight="30.0" fitWidth="125.0" pickOnBounds="true" preserveRatio="true">
-                           <image>
-                              <Image url="@moelven_logo_title.png" />
-                           </image>
-                        </ImageView>
-                     </center>
-                  </BorderPane>
-               </children>
-            </AnchorPane>
-         </center>
-         <top>
-            <MenuBar prefHeight="25.0" prefWidth="700.0" BorderPane.alignment="CENTER">
-              <menus>
-                <Menu mnemonicParsing="false" text="File">
-                  <items>
-                    <MenuItem mnemonicParsing="false" text="Close" />
-                  </items>
-                </Menu>
-                <Menu mnemonicParsing="false" text="Edit">
-                  <items>
-                    <MenuItem mnemonicParsing="false" text="Delete" />
-                  </items>
-                </Menu>
-                <Menu mnemonicParsing="false" text="Help">
-                  <items>
-                    <MenuItem mnemonicParsing="false" text="About" />
-                  </items>
-                </Menu>
-              </menus>
-            </MenuBar>
-         </top>
-      </BorderPane>
-   </top>
-</BorderPane>
diff --git a/target/classes/com/application/DB/Constants.class b/target/classes/com/application/DB/Constants.class
index b1c92708a53d5d9c8d893548aa6254494e72c3a3..12b796c5c7f59d192a5504fb50d7263ec9fee188 100644
Binary files a/target/classes/com/application/DB/Constants.class and b/target/classes/com/application/DB/Constants.class differ
diff --git a/target/classes/com/application/DB/DB.class b/target/classes/com/application/DB/DB.class
index dc3e7ef07457159c4cffad723fd086a463c4bef4..907ca7cd83870015b2dfa3d10e234e29292ea61b 100644
Binary files a/target/classes/com/application/DB/DB.class and b/target/classes/com/application/DB/DB.class differ
diff --git a/target/classes/com/application/DB/HelpingFunctions.class b/target/classes/com/application/DB/HelpingFunctions.class
index 54fe7ed89c186ec2dc6974e7c5a5c6011b0df055..77d4802660217db2dbb5a825bf559f40a6d64f55 100644
Binary files a/target/classes/com/application/DB/HelpingFunctions.class and b/target/classes/com/application/DB/HelpingFunctions.class differ
diff --git a/target/classes/com/application/GUI/InputPopUpWindow.class b/target/classes/com/application/GUI/InputPopUpWindow.class
index 6f8be194dd66499c7a4cda284470d56527148834..22435a873bdd72d725141bb68ad28bf4d1bb7f2d 100644
Binary files a/target/classes/com/application/GUI/InputPopUpWindow.class and b/target/classes/com/application/GUI/InputPopUpWindow.class differ
diff --git a/target/classes/com/application/GUI/LineChartFunctionality.class b/target/classes/com/application/GUI/LineChartFunctionality.class
index 5a32389b113ac7d683fcb180754a030be228f01d..f70466837b2fd6c3753ca6494fe6f688c79c214e 100644
Binary files a/target/classes/com/application/GUI/LineChartFunctionality.class and b/target/classes/com/application/GUI/LineChartFunctionality.class differ
diff --git a/target/classes/com/application/GUI/OutputPopUpWindow.class b/target/classes/com/application/GUI/OutputPopUpWindow.class
index c8972540dd67702c1f8cd361d98d6357e1aedfda..3ce6d7422da8fe27aa5bfd05cc8d07d7c6ca9408 100644
Binary files a/target/classes/com/application/GUI/OutputPopUpWindow.class and b/target/classes/com/application/GUI/OutputPopUpWindow.class differ