diff --git a/src/main/java/com/application/DB/DB.java b/src/main/java/com/application/DB/DB.java
index 552b7573a0dfafe850d3f161d9f5c9da22103b09..5c3d6d9ec1c456315235eb3d782fe175c6499244 100644
--- a/src/main/java/com/application/DB/DB.java
+++ b/src/main/java/com/application/DB/DB.java
@@ -60,7 +60,7 @@ public class DB {
         //getKwh();
         //getName();
         //getZeroPointDate();
-        System.out.println(setInputParameters());
+        System.out.println(setInputParameters(false,false,false,false));
 
     }
 
@@ -128,15 +128,23 @@ public class DB {
     }
 
 
-    public static Map<Integer, Map<String, Number>> setInputParameters() throws Exception {
+    public static Map<Integer, Map<String, Number>> setInputParameters(boolean sawsetRemoved,
+                                                                       boolean treespeciesRemoved,
+                                                                       boolean dimensionsRemoved,
+                                                                       boolean moistureRemoved) throws Exception {
     //public static Map<String, String> setInputParameters() throws Exception {
-        Map<Integer, Map<String, Number>> allDryingPeriods = new TreeMap<>();
+        Map<Integer, Map<String, Number>> allDryingPeriods = null;
 
 
         String extraInputParameter = "";
-        int locationID = 0;
+        int locationID;
         int index = 0;
 
+        String treeSpecies = "";
+        String dimensions = "";
+        String sawset = "";
+        String moistureGoal = "";
+
         // Valmetics parameters
         String nameParameter = "";
         String kilinName = "";
@@ -156,6 +164,8 @@ public class DB {
         for (HashMap.Entry<Integer, HashMap<String, HashMap<String, String>>> location : Constants.getSawmills().entrySet()) {
             System.out.printf("\n\nLocation ID: \t%s\t\t\tRest of map: \t%s\n", location.getKey(), location.getValue());
 
+            allDryingPeriods = new TreeMap<>();
+
             locationID = location.getKey();
 
             //System.out.println(location.getValue());
@@ -208,10 +218,10 @@ public class DB {
 
 
 
-            String treeSpecies = "AND LOWER(" + nameParameter + ") LIKE LOWER(" + '"' + "%" + TREE_SPECIES + "%" + '"' + ") ";
-            String dimensions = "AND LOWER(" + nameParameter + ") LIKE LOWER(" + '"' + "%" + DIMENSIONS + "%" + '"' + ") ";
-            String sawset = "AND LOWER(" + nameParameter + ") LIKE LOWER(" + '"' + "%" + SAWSET + "%" + '"' + ") ";
-            String moistureGoal = "AND LOWER(" + nameParameter + ") LIKE LOWER(" + '"' + "%" + MOISTURE_GOAL + "%" + '"' + ") ";
+            if (!treespeciesRemoved) treeSpecies = "AND LOWER(" + nameParameter + ") LIKE LOWER(" + '"' + "%" + TREE_SPECIES + "%" + '"' + ") ";
+            if (!dimensionsRemoved) dimensions = "AND LOWER(" + nameParameter + ") LIKE LOWER(" + '"' + "%" + DIMENSIONS + "%" + '"' + ") ";
+            if (!sawsetRemoved) sawset = "AND LOWER(" + nameParameter + ") LIKE LOWER(" + '"' + "%" + SAWSET + "%" + '"' + ") ";
+            if (!moistureRemoved) moistureGoal = "AND LOWER(" + nameParameter + ") LIKE LOWER(" + '"' + "%" + MOISTURE_GOAL + "%" + '"' + ") ";
 
 
             // Input parameters
@@ -229,34 +239,40 @@ public class DB {
             }
 
             Map<Integer, Map<String, Number>> results = new TreeMap<>();
+            results = getKwh(getZeroPointDate(locationID, extraInputParameter, nameParameter, kilinName, kilinID, startDryingTime, stopDryingTime, valmeticsTableName, limit),
+                    locationID, kwhTableName, KwhName, timestamp,valueIDName, valueID, index);
 
-            while (true) {
-                System.out.printf("\nExtra parameters:\n %s\n\n", extraInputParameter);
-                // Retrieves the dates
-                //results = getKwh(getZeroPointDate(locationID, extraInputParameter, nameParameter, kilinName, kilinID, startDryingTime, stopDryingTime, valmeticsTableName, limit));
-                results = getKwh(getZeroPointDate(locationID, extraInputParameter, nameParameter, kilinName, kilinID, startDryingTime, stopDryingTime, valmeticsTableName, limit),
-                        locationID, kwhTableName, KwhName, timestamp,valueIDName, valueID, index);
-
-                // Checks if any dates where found, if not parameters are removed until dates are found
-                if (results.size() < NUMBER_OF_PERIODS) {
-                    if (extraInputParameter.contains(sawset)) {
-                        extraInputParameter = extraInputParameter.replace(sawset, "");
-                        System.out.println("Sawset is removed");
-                    } else if (extraInputParameter.contains(treeSpecies)) {
-                        extraInputParameter = extraInputParameter.replace(treeSpecies, "");
-                        System.out.println("Tree species is removed");
-                    } else if (extraInputParameter.contains(dimensions)) {
-                        extraInputParameter = extraInputParameter.replace(dimensions, "");
-                        System.out.println("Dimensions is removed");
-                    } else if (extraInputParameter.contains(moistureGoal)) {
-                        extraInputParameter = extraInputParameter.replace(moistureGoal, "");
-                        System.out.println("Moisture goal is removed");
-                    } else break;
-                } else break;
-            }
             allDryingPeriods.putAll(results);
             index += results.size();
         }
+
+        while (true) {
+            System.out.printf("\nExtra parameters:\n %s\n\n", extraInputParameter);
+            // Retrieves the dates
+            //results = getKwh(getZeroPointDate(locationID, extraInputParameter, nameParameter, kilinName, kilinID, startDryingTime, stopDryingTime, valmeticsTableName, limit));
+
+            // Checks if any dates where found, if not parameters are removed until dates are found
+            if (allDryingPeriods.size() < NUMBER_OF_PERIODS) {
+                if (extraInputParameter.contains(sawset) && !sawsetRemoved) {
+                    extraInputParameter = extraInputParameter.replace(sawset, "");
+                    System.out.println("Sawset is removed");
+                    setInputParameters(true,false,false,false);
+                } else if (extraInputParameter.contains(treeSpecies) && !treespeciesRemoved) {
+                    extraInputParameter = extraInputParameter.replace(treeSpecies, "");
+                    System.out.println("Tree species is removed");
+                    setInputParameters(true,true,false,false);
+                } else if (extraInputParameter.contains(dimensions) && !dimensionsRemoved) {
+                    extraInputParameter = extraInputParameter.replace(dimensions, "");
+                    System.out.println("Dimensions is removed");
+                    setInputParameters(true,true,true,false);
+                } else if (extraInputParameter.contains(moistureGoal) && !moistureRemoved) {
+                    extraInputParameter = extraInputParameter.replace(moistureGoal, "");
+                    System.out.println("Moisture goal is removed");
+                    setInputParameters(true,true,true,true);
+                } else break;
+            } else break;
+        }
+
         System.out.println(allDryingPeriods.size());
         for (Map.Entry<Integer, Map<String, Number>> entry : allDryingPeriods.entrySet()) {
             System.out.printf("Timestamp: \t%s\t\t\tkWh: \t%s\n", entry.getKey(), entry.getValue());
diff --git a/src/main/java/com/application/GUI/InputPopUpWindow.java b/src/main/java/com/application/GUI/InputPopUpWindow.java
index 3477f8003049cd3901e0ba08dcbf3f9b65b190f4..b304471ee7e6919c6390eb92cf44b26b479c550a 100644
--- a/src/main/java/com/application/GUI/InputPopUpWindow.java
+++ b/src/main/java/com/application/GUI/InputPopUpWindow.java
@@ -4,10 +4,13 @@ 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.concurrent.*;
+
 import static com.application.DB.Constants.*;
 import static com.application.Main.*;
 import static com.application.DB.DB.setInputParameters;
@@ -22,6 +25,19 @@ import static com.application.GUI.LineChartFunctionality.loadSingleSeries;
  */
 public class InputPopUpWindow {
 
+    public static CompletableFuture<LineChart<String, Number>> getData(){
+        CompletableFuture<LineChart<String, Number>> completableFuture = new CompletableFuture<>();
+
+        Executors.newCachedThreadPool().submit(() -> {
+            Thread.sleep(500);
+            completableFuture.complete(loadSingleSeries(setInputParameters(false,
+                    false,false,false)));
+            return null;
+        });
+
+        return completableFuture;
+    }
+
     public static void display() {
         Stage window = new Stage();
 
@@ -110,10 +126,18 @@ public class InputPopUpWindow {
                     MOISTURE_GOAL = moistureList.getValue();
 
                     // If the input is null, sets the value to be empty
-                    if(treeSpeciesList.getValue() == null){TREE_SPECIES = "";}
-                    if(dimensionsList.getValue() == null){DIMENSIONS = "";}
-                    if(sawsetList.getValue() == null){SAWSET = "";}
-                    if(moistureList.getValue() == null){MOISTURE_GOAL = "";}
+                    if (treeSpeciesList.getValue() == null) {
+                        TREE_SPECIES = "";
+                    }
+                    if (dimensionsList.getValue() == null) {
+                        DIMENSIONS = "";
+                    }
+                    if (sawsetList.getValue() == null) {
+                        SAWSET = "";
+                    }
+                    if (moistureList.getValue() == null) {
+                        MOISTURE_GOAL = "";
+                    }
 
                     setTreeSpeciesText(TREE_SPECIES);
                     setDimensionsText(DIMENSIONS);
@@ -123,8 +147,30 @@ public class InputPopUpWindow {
                     window.close();
 
 
+
+
+/*
+                    FutureTask[] randomNumberTasks = new FutureTask[1];
+                    Callable callable = new CallableExample();
+                    randomNumberTasks[0] = new FutureTask(callable);
+                    Thread t = new Thread(randomNumberTasks[0]);
+                    t.start();
+
                     try {
-                        loadSingleSeries(setInputParameters());
+                        System.out.println(randomNumberTasks[0].get());
+                    } catch (InterruptedException | ExecutionException ex) {
+                        ex.printStackTrace();
+                    }
+
+                });
+
+ */
+
+
+
+                    try {
+                        getData();
+                        //loadSingleSeries(setInputParameters(false,false,false,false));
                         //loadMultipleSeries(setInputParameters());
                         //loadSingleSeries();
                         //loadMultipleSeries();
@@ -135,7 +181,11 @@ public class InputPopUpWindow {
 
                 );
 
-            /*
+
+
+
+
+/*
             try{
                 Thread thread = new Thread(new Runnable() {
 
@@ -143,7 +193,7 @@ public class InputPopUpWindow {
                     public void run() {
                         try {
                             // Henter her data fra databasen
-                            loadSingleSeries(setInputParameters());
+                            loadSingleSeries(setInputParameters(false,false,false,false));
                             //loadSingleSeries();
                             //loadMultipleSeries();
                         } catch (Exception ex) {
@@ -158,7 +208,7 @@ public class InputPopUpWindow {
                 }
                 );
 
-             */
+ */
 
 /*
                     // Fungerende ny thread!!@@@@@
diff --git a/target/classes/com/application/DB/DB.class b/target/classes/com/application/DB/DB.class
index b45465c0d555e36620039dc871257a81d7669b96..6238fce9aa2d95d0e06960ebaa0ba4fbb8944821 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/GUI/InputPopUpWindow.class b/target/classes/com/application/GUI/InputPopUpWindow.class
index c7a5a61caaaf14b86600a4d4bcf9d9e5cbb3e30b..67be2b11dadcc835d48052b6830ed4398ec413d8 100644
Binary files a/target/classes/com/application/GUI/InputPopUpWindow.class and b/target/classes/com/application/GUI/InputPopUpWindow.class differ