diff --git a/Bachelor_application.iml b/Bachelor_application.iml
index 06a8fa9ccd7558c365b321eced705ef4f63de40c..e44eb08e2ddc937de337a2975eda2ef53dc4f301 100644
--- a/Bachelor_application.iml
+++ b/Bachelor_application.iml
@@ -54,5 +54,37 @@
     <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" />
   </component>
 </module>
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 51648b17b7224b51ee9052b3b136ff9a1d2b888a..6c3d1d181a6b761cddbf8b2bdfa0624b573f07ad 100644
--- a/pom.xml
+++ b/pom.xml
@@ -40,6 +40,11 @@
             <artifactId>joda-time</artifactId>
             <version>2.10.14</version>
         </dependency>
+        <dependency>
+            <groupId>org.python</groupId>
+            <artifactId>jython-slim</artifactId>
+            <version>2.7.2</version>
+        </dependency>
     </dependencies>
 
     <properties>
diff --git a/src/main/java/com/application/DB/DB.java b/src/main/java/com/application/DB/DB.java
index 9a72927f0a4de53627b074ed96b5cfda5c96edc3..6b14b5690907b645ed3717a4f11d01a0b26a8e31 100644
--- a/src/main/java/com/application/DB/DB.java
+++ b/src/main/java/com/application/DB/DB.java
@@ -11,7 +11,7 @@ import static com.application.DB.Constants.*;
  * This class is responsible for handling database related activities
  *
  * @author Eilert Tunheim, Karin Pettersen, Mads Arnesen
- * @version 1.1
+ * @version 1.0
  */
 public class DB {
 
@@ -77,8 +77,11 @@ public class DB {
 
             for (HashMap.Entry<Integer, HashMap<String, HashMap<String, String>>> location : Constants.getSawmills().entrySet()) {
 
+                // Clears the extraInputs variable
+                extraInputParameter = "";
+
                 System.out.printf("\nLocation ID: \t%s\t\t\tRest of map: \t%s\n", location.getKey(), location.getValue());
-                System.out.println("Number of entries: "+Constants.getSawmills().size());
+                System.out.println("Number of sawmills: "+Constants.getSawmills().size());
 
                 //allDryingPeriods = new TreeMap<>();
 
@@ -96,6 +99,9 @@ public class DB {
                     kwhChamberIDS = getValasenKwhChamberIDS();
                 }
                 if (location.getKey() == 174) {
+                    if (TREE_SPECIES.equalsIgnoreCase("Fura")) {
+                        TREE_SPECIES = "Furu";
+                    }
                     locationTables = getArjangTableNames();
                     valmeticsChamberIDS = getArjangValmeticsChamberIDS();
                     kwhChamberIDS = getArjangKwhChamberIDS();
@@ -232,7 +238,7 @@ public class DB {
                                                            String timestamp, String valueIDName,
                                                            int valueID, int index) throws Exception {
 
-        System.out.println("GetMan size: " + HelpingFunctions.getManMoist().size());
+        int indx=  0;
 
         // Initializing the data map to store the results
         Map<Integer, Map<String, Number>> finalResults = new HashMap<>();
@@ -293,6 +299,20 @@ public class DB {
             if (!sortedData.isEmpty() && sortedData.size() > 50) {
                 finalResults.put(index, sortedData);
                 index += 1;
+
+                // entry.value burde matche med en av de og går igjennom alle
+                for (Map.Entry<String, String> moistureEntry : HelpingFunctions.getManMoist().entrySet()) {
+
+                    if(moistureEntry.getKey().equals(entry.getValue())){
+                        // Adjust kwh
+                        System.out.println("Inni!!@@@@@");
+                        System.out.printf("Mouisture key: \t%s",moistureEntry.getKey());
+                        System.out.printf("\nFormatedUtTid: \t%s",entry.getValue());
+                        System.out.println("\nMoisture diff: " + moistureEntry.getValue());
+                        indx++;
+                        System.out.println(indx);
+                    }
+                }
             }
         }
 
@@ -301,6 +321,20 @@ 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();
+            for (Map.Entry<String, Number> moistureEntry : data.entrySet()) {
+
+                //System.out.println("Data key: "+moistureEntry.getKey());        // Key = datetime: 2022-01-18 20:23:36
+                //System.out.println("Data Value: "+moistureEntry.getValue());    // Value = kwh: 5422
+            }
+
+        }
 
         for (Map.Entry<Integer, Map<String, Number>> entry : sortedFinalResults.entrySet()) {
             System.out.printf("Timestamp: \t%s\t\t\tkWh: \t%s\n", entry.getKey(), entry.getValue());
@@ -332,8 +366,6 @@ public class DB {
         String thickness = "";
         String width = "";
         String sawSet = "";
-
-        String moistureGoal = "";
         String moistureMeasured = "";
 
         String formatedInTidTork = "";
@@ -492,7 +524,7 @@ public class DB {
                         "AND Dato BETWEEN \"" + date + "\" AND \"" + formatedUtTidTorkPlussDays + "\" " +
                         "ORDER BY Dato";
 
-                //System.out.println(manMeasurementStatement);
+                System.out.println(manMeasurementStatement);
 
 
                 // Retrieves the results from the queryjob
diff --git a/src/main/java/com/application/DB/HelpingFunctions.java b/src/main/java/com/application/DB/HelpingFunctions.java
index e61b87777253e1d1b6ec3c6ec7216924a35f3878..5467ca7743cfd3294e3a80c72138495faffd3658 100644
--- a/src/main/java/com/application/DB/HelpingFunctions.java
+++ b/src/main/java/com/application/DB/HelpingFunctions.java
@@ -66,7 +66,7 @@ public class HelpingFunctions {
     }
 
     /**
-     * Creates a job
+     * Creates a job for the database
      *
      * @param queryConfig query configuration information
      * @return a job
@@ -109,11 +109,12 @@ public class HelpingFunctions {
 
     }
 
+    /**
+     * Stores data about manual measurements for moisture level in the lumber
+     *
+     * @return a list containing the outdate for the lumber and the corresponding diff value
+     */
     public static Map<String, String> getManMoist() {
         return manMoist;
     }
-
-    public static void setManMoist(Map<String, String> manMoist) {
-        HelpingFunctions.manMoist = manMoist;
-    }
 }
diff --git a/src/main/java/com/application/GUI/InputPopUpWindow.java b/src/main/java/com/application/GUI/InputPopUpWindow.java
index 94297a6accd197c7baac7f9d5594ac07f69b49fc..22c1947cbbd5bc239cae9ec21140111470c78e67 100644
--- a/src/main/java/com/application/GUI/InputPopUpWindow.java
+++ b/src/main/java/com/application/GUI/InputPopUpWindow.java
@@ -5,13 +5,12 @@ import javafx.collections.FXCollections;
 import javafx.collections.ObservableList;
 import javafx.geometry.Pos;
 import javafx.scene.*;
-import javafx.scene.chart.LineChart;
 import javafx.scene.control.*;
 import javafx.scene.layout.*;
 import javafx.stage.*;
 
 import java.util.Map;
-import java.util.concurrent.*;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 import static com.application.DB.Constants.*;
 import static com.application.Main.*;
@@ -27,18 +26,24 @@ import static com.application.GUI.LineChartFunctionality.loadSingleSeries;
  */
 public class InputPopUpWindow {
 
-    public static CompletableFuture<LineChart<String, Number>> getData(){
-        CompletableFuture<LineChart<String, Number>> completableFuture = new CompletableFuture<>();
+    private static Thread dataThread;
 
-        Executors.newCachedThreadPool().submit(() -> {
-            Thread.sleep(500);
-            completableFuture.complete(loadSingleSeries(setInputParameters()));
-            return null;
-        });
+    public static Thread getDataThread(){
+        return dataThread;
+    }
+
+    public static void setDataThread(Thread dataThread) {
+        InputPopUpWindow.dataThread = dataThread;
+    }
 
-        return completableFuture;
+    public static void exitDataThread(){
+        InputPopUpWindow.dataThread.interrupt();
+        Platform.exit();
+        System.exit(0);
     }
 
+
+
     public static void display() {
         Stage window = new Stage();
 
@@ -223,23 +228,26 @@ public class InputPopUpWindow {
 
                     // Fungerende ny thread!!@@@@@
                     try{
-                        Thread thread = new Thread(() -> {
-                            try {
-                                // Henter her data fra databasen
-                                Map<Integer, Map<String, Number>> data = setInputParameters();
-                                Platform.runLater(() -> {
-                                    try {
-                                        loadSingleSeries(data);
-                                    } catch (Exception ex) {
-                                        ex.printStackTrace();
-                                    }
-                                });
-                            } catch (Exception ex) {
-                                ex.printStackTrace();
+                        setDataThread(new Thread(() -> {
+
+                                try {
+                                    // Henter her data fra databasen
+                                    Map<Integer, Map<String, Number>> data = setInputParameters();
+                                    Platform.runLater(() -> {
+                                        try {
+                                            loadSingleSeries(data);
+                                        } catch (Exception ex) {
+                                            ex.printStackTrace();
+                                        }
+                                    });
+                                } catch (Exception ex) {
+                                    ex.printStackTrace();
+                                }
                             }
-                        });
-                        thread.interrupt();
-                        thread.start();
+                        ));
+                        InputPopUpWindow.dataThread.interrupt();
+                        getDataThread().setDaemon(true);
+                        getDataThread().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 d0f1c25942df05306f4ccf9b4f22347aef285288..0bc011d3ceabfde64ec794211be23dc89270df61 100644
--- a/src/main/java/com/application/GUI/LineChartFunctionality.java
+++ b/src/main/java/com/application/GUI/LineChartFunctionality.java
@@ -9,6 +9,7 @@ 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.util.*;
 
@@ -185,6 +186,9 @@ public class LineChartFunctionality {
             }
         }
 
+        PythonInterpreter pythonInterpreter = new PythonInterpreter();
+        //pythonInterpreter
+
 
 
         XYChart.Series<String, Number> regressionSeries = new XYChart.Series<String, Number>();
@@ -194,7 +198,7 @@ public class LineChartFunctionality {
             //System.out.println(simpleRegression.predict(i));
             regressionSeries.getData().add(new XYChart.Data<String, Number>(String.valueOf(i), simpleRegression.predict(i)));
         }
-        updateLineChart(regressionSeries);
+        //updateLineChart(regressionSeries);
         //lineChart.setOpacity(1);
 
 
diff --git a/src/main/java/com/application/Main.java b/src/main/java/com/application/Main.java
index c7af669e7be403990687a4f5aea558c9094125fa..2a15a6eb4f244bc1d32dc735709c16fe8dcf6edc 100644
--- a/src/main/java/com/application/Main.java
+++ b/src/main/java/com/application/Main.java
@@ -122,8 +122,6 @@ public class Main extends Application {
 
         // Displays the input parameters popup window
         InputPopUpWindow.display();
-
-        System.out.println(Constants.getSawmills());
     }
 
     /**
@@ -163,7 +161,7 @@ public class Main extends Application {
         treeSpeciesLabel.setId("sideBarLabelText");
         treeSpeciesText = new TextField();
         treeSpeciesText.setId("sideBarLabelText");
-        treeSpeciesText.setPromptText("Gran");
+        treeSpeciesText.setPromptText("No Input");
         treeSpeciesText.setText(TREE_SPECIES);
         treeSpeciesText.setEditable(false);
 
@@ -171,7 +169,7 @@ public class Main extends Application {
         dimensionsLabel.setId("sideBarLabelText");
         dimensionsText = new TextField();
         dimensionsText.setId("sideBarLabelText");
-        dimensionsText.setPromptText("47 x 150");
+        dimensionsText.setPromptText("No Input");
         dimensionsText.setText(DIMENSIONS);
         dimensionsText.setEditable(false);
 
@@ -179,7 +177,7 @@ public class Main extends Application {
         sawsetLabel.setId("sideBarLabelText");
         sawsetText = new TextField();
         sawsetText.setId("sideBarLabelText");
-        sawsetText.setPromptText("4x");
+        sawsetText.setPromptText("No Input");
         sawsetText.setText(SAWSET);
         sawsetText.setEditable(false);
 
@@ -187,7 +185,7 @@ public class Main extends Application {
         moistureGoalLabel.setId("sideBarLabelText");
         moistureGoalText = new TextField();
         moistureGoalText.setId("sideBarLabelText");
-        moistureGoalText.setPromptText("16%");
+        moistureGoalText.setPromptText("No Input");
         moistureGoalText.setText(MOISTURE_GOAL);
         moistureGoalText.setEditable(false);
 
@@ -199,6 +197,10 @@ public class Main extends Application {
         finishButton.setId("sideBarButtonFinish");
         finishButton.setOnAction(e -> OutputPopUpWindow.displayOutputWindow());
 
+        Button exitButton = new Button("Exit");
+        exitButton.setId("sideBarButtonExit");
+        exitButton.setOnAction(e -> InputPopUpWindow.exitDataThread());
+
 
 
         // Creating the circular progressbar
@@ -243,7 +245,7 @@ public class Main extends Application {
 
 
         sideBarVBox.getChildren().addAll(ringProgressIndicator, treeSpeciesLabel, treeSpeciesText, dimensionsLabel, dimensionsText,
-                sawsetLabel, sawsetText, moistureGoalLabel, moistureGoalText, inputParametersButton, finishButton);
+                sawsetLabel, sawsetText, moistureGoalLabel, moistureGoalText, inputParametersButton, finishButton, exitButton);
 
         VBox.setVgrow(sideBarVBox, Priority.ALWAYS);
 
diff --git a/src/main/resources/com.application/CSS/styleSheet.css b/src/main/resources/com.application/CSS/styleSheet.css
index 9eacafe326bf12e982307459cdd56333a28c319f..70d9445d4fce81779c39abcc8e07c3b966ab826c 100644
--- a/src/main/resources/com.application/CSS/styleSheet.css
+++ b/src/main/resources/com.application/CSS/styleSheet.css
@@ -63,6 +63,17 @@
     -fx-background-color: rgba(104, 229, 59, 1);
 }
 
+#sideBarButtonExit {
+    -fx-translate-x: 5;
+    -fx-translate-y: 75;
+    -fx-pref-width: infinity;
+    -fx-pref-height: 25;
+    -fx-font-size: 20;
+    -fx-font-family: Arial;
+    -fx-background-color: Red;
+    -fx-text-fill: white;
+}
+
 /*
     Input popup window
  */
@@ -113,5 +124,16 @@
     -fx-alignment: bottom-center;
 }
 
+#inputButtonExit {
+    -fx-pref-width: infinity;
+    -fx-translate-y: 10;
+    -fx-pref-height: 25;
+    -fx-font-size: 20;
+    -fx-font-family: Arial;
+    -fx-background-color: rgba(12, 76, 81, 1);
+    -fx-text-fill: white;
+    -fx-alignment: bottom-center;
+}
+
 
 
diff --git a/target/classes/com.application/CSS/styleSheet.css b/target/classes/com.application/CSS/styleSheet.css
index 9eacafe326bf12e982307459cdd56333a28c319f..70d9445d4fce81779c39abcc8e07c3b966ab826c 100644
--- a/target/classes/com.application/CSS/styleSheet.css
+++ b/target/classes/com.application/CSS/styleSheet.css
@@ -63,6 +63,17 @@
     -fx-background-color: rgba(104, 229, 59, 1);
 }
 
+#sideBarButtonExit {
+    -fx-translate-x: 5;
+    -fx-translate-y: 75;
+    -fx-pref-width: infinity;
+    -fx-pref-height: 25;
+    -fx-font-size: 20;
+    -fx-font-family: Arial;
+    -fx-background-color: Red;
+    -fx-text-fill: white;
+}
+
 /*
     Input popup window
  */
@@ -113,5 +124,16 @@
     -fx-alignment: bottom-center;
 }
 
+#inputButtonExit {
+    -fx-pref-width: infinity;
+    -fx-translate-y: 10;
+    -fx-pref-height: 25;
+    -fx-font-size: 20;
+    -fx-font-family: Arial;
+    -fx-background-color: rgba(12, 76, 81, 1);
+    -fx-text-fill: white;
+    -fx-alignment: bottom-center;
+}
+
 
 
diff --git a/target/classes/com/application/DB/DB.class b/target/classes/com/application/DB/DB.class
index 1cb086d427e64118fcf74cecea9e795e619f44d3..dc3e7ef07457159c4cffad723fd086a463c4bef4 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 0c644a7badd0c88a75e0b8f22f2d231457963371..54fe7ed89c186ec2dc6974e7c5a5c6011b0df055 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 97e79c931083ef8b641e3b95cce2a7cdfd346f8d..6f8be194dd66499c7a4cda284470d56527148834 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 5114429200f1c808b85caad3617510f534fe86cf..5a32389b113ac7d683fcb180754a030be228f01d 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/Main$1WorkerThread.class b/target/classes/com/application/Main$1WorkerThread.class
index 8b34aeaa44ad3497f9d1132d6e88cf8bf0cb46f2..96fdabd6ebabc2018a0dd6405c464e591d7e57cb 100644
Binary files a/target/classes/com/application/Main$1WorkerThread.class and b/target/classes/com/application/Main$1WorkerThread.class differ
diff --git a/target/classes/com/application/Main.class b/target/classes/com/application/Main.class
index edc2049c922de5c72aaf6cb05f0b0082c79796d3..4f200bb95090d532276bac28a3d5cf147cbf33a6 100644
Binary files a/target/classes/com/application/Main.class and b/target/classes/com/application/Main.class differ