diff --git a/src/main/java/com/application/DB/Constants.java b/src/main/java/com/application/DB/Constants.java
index ae704396fb2dbb59cd3be5faf3c33da172dfcef5..4c7abb95039f8e54fa497bea9af88469015d1ba1 100644
--- a/src/main/java/com/application/DB/Constants.java
+++ b/src/main/java/com/application/DB/Constants.java
@@ -1,14 +1,87 @@
 package com.application.DB;
 
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+
 /**
  * This class contains constants to be used related to database activities
  */
 public final class Constants {
 
+    // Format for today's date
+    static DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+
     private Constants() {
         // Empty constructor
     }
 
+    // Today's date
+    public static final String TODAYS_DATE = format.format(LocalDateTime.now());
+
+    // User inputs
+    public static final String TREE_SPECIES = "";
+    public static final String WIDTH_DIMENTION = "";
+    public static final String HEIGHT_DIMENTION = "";
+    public static final String SAWSET = "";
+    public static final int MOISTURE_GOAL = 0;
+
+    // Database ID/name
     public static final String PROJECT_ID = "sf-drying-optimization";
 
+
+    /*
+    // Location Valasen(124)
+    // Project settings
+    public static final int LOCATION_ID = 124;
+    public static final String TABLE_NAME_VALMATICS = "int_dk_valmaticsdryingbatches_v2";
+    public static final String TABLE_NAME_KWH = "int_sd_winccsensordata";
+
+    // Parameters settings
+    // Valmatics
+    public static final String OTHER_PARAMETERS_NAME = "Name";
+    public static final String START_DRYING_NAME = "DryingStarted";
+    public static final String STOP_DRYING_NAME = "CalculatedStop";
+    public static final String KILIN_NAME = "KilnName";
+    public static int KILIN_ID = 5;
+
+    // Winccsensordata
+    public static final String KWH_NAME = "VariantValue";
+    public static final String TIMESTAMP_NAME = "Timestamp";
+    public static final String VALUE_ID_NAME = "ValueID";
+    public static final int VALUE_ID = 51;
+    public static final int LIMIT = 1000;
+
+     */
+
+
+
+
+
+    // Location Arjang(174)
+    // Project settings
+    public static final int LOCATION_ID = 174;
+    public static final String TABLE_NAME_VALMATICS = "int_dk_valmaticsdryingbatches";
+    public static final String TABLE_NAME_KWH = "int_sd_swappconsensordata";
+
+    // Parameters settings
+    // Valmatics
+    public static final String OTHER_PARAMETERS_NAME = "Name";
+    public static final String START_DRYING_NAME = "DryingStarted";
+    public static final String STOP_DRYING_NAME = "DryingCompleted";
+    public static final String KILIN_NAME = "KilinId";
+    //public static int KILIN_ID = 18;
+    public static int KILIN_ID = 18133;
+
+    // Swappconsensordata
+    public static final String KWH_NAME = "RealValue";
+    public static final String TIMESTAMP_NAME = "Timestamp";
+    public static final String VALUE_ID_NAME = "ValueID";
+    public static final int VALUE_ID = 19;
+    public static final int LIMIT = 1000;
+
+
+
+
+
+
 }
diff --git a/src/main/java/com/application/DB/DB.java b/src/main/java/com/application/DB/DB.java
index b425377c0b0e6e5cf2c10ea6f77735fdd614e124..0392a00b38628eaff02cfa5b8f7a854020258913 100644
--- a/src/main/java/com/application/DB/DB.java
+++ b/src/main/java/com/application/DB/DB.java
@@ -6,12 +6,10 @@ import com.google.cloud.bigquery.*;
 
 import java.io.File;
 import java.io.FileInputStream;
-import java.sql.Timestamp;
 import java.text.SimpleDateFormat;
-import java.time.LocalDateTime;
-import java.time.format.DateTimeFormatter;
 import java.util.*;
 
+
 import static com.application.DB.Constants.*;
 
 /**
@@ -158,7 +156,7 @@ public class DB {
             // Preparing a query statement
             /*
             final String sqlStatement = "SELECT DISTINCT TimeStamp, VariantValue " +
-                    "FROM sf-drying-optimization.124.int_sd_winccsensordata " +
+                    "FROM `" + PROJECT_ID + "." + LOCATION_ID + "." + TABLE_NAME_KWH + "` " +
                     "WHERE TimeStamp BETWEEN " + '"'+ entry.getKey() + '"' +
                     " AND " + '"' + entry.getValue() + '"' +
                     " ORDER BY TimeStamp ASC";
@@ -167,23 +165,26 @@ public class DB {
 
             // Preparing a query statement
             // Query statement 124 Valåsen
-            final String sqlStatement = "SELECT `TimeStamp`, `VariantValue` " +
-                    "FROM `sf-drying-optimization.124.int_sd_winccsensordata` " +
-                    "WHERE TimeStamp BETWEEN " + '"'+ entry.getKey() + '"' +
+            final String sqlStatement = "SELECT `" + TIMESTAMP_NAME + "`, `"+KWH_NAME+"` " +
+                    "FROM `" + PROJECT_ID + "." + LOCATION_ID + "." + TABLE_NAME_KWH + "` " +
+                    "WHERE " + TIMESTAMP_NAME + " BETWEEN " + '"'+ entry.getKey() + '"' +
                     " AND " + '"' + entry.getValue() + '"' +
-                    " AND ValueID = 51" +
-                    " ORDER BY TimeStamp ASC";
+                    " AND " + VALUE_ID_NAME + " = " + VALUE_ID + " " +
+                    " AND " + KWH_NAME + " <> 0 " +
+                    " ORDER BY " + TIMESTAMP_NAME + " ASC";
+
 
 
             /*
             // Query statement 174 Årjang
             final String sqlStatement =
-                    "SELECT Timestamp, RealValue FROM `sf-drying-optimization.174.int_sd_swappconsensordata` " +
-                            "WHERE TimeStamp BETWEEN " + '"'+ entry.getKey() + '"' +
-                            " AND " + '"' + entry.getValue() + '"' +
-                            "AND ValueID = 19 " +
-                            "AND RealValue <> 0 " +
-                            "ORDER BY TimeStamp ASC";
+                    "SELECT Timestamp, RealValue
+                    "FROM `" + PROJECT_ID + "." + LOCATION_ID + "." + TABLE_NAME_KWH + "` " +
+                    "WHERE TimeStamp BETWEEN " + '"'+ entry.getKey() + '"' +
+                    " AND " + '"' + entry.getValue() + '"' +
+                    "AND ValueID = 19 " +
+                    "AND RealValue <> 0 " +
+                    "ORDER BY TimeStamp ASC";
 
              */
 
@@ -198,28 +199,24 @@ public class DB {
 
                 // Sets the baseline in order to reset the kWh counter
                 if (baseline == 0){
-                    baseline = row.get("VariantValue").getNumericValue().intValue();
+                    baseline = row.get(""+KWH_NAME+"").getNumericValue().intValue();
                 }
                 //System.out.println("baseline: "+baseline);
 
                 // kWh value
-                int variantValue = row.get("VariantValue").getNumericValue().intValue()-baseline; //-baseline
+                int variantValue = row.get(""+KWH_NAME+"").getNumericValue().intValue()-baseline; //-baseline
 
                 // Retrieving the wanted data
-                long timeStamp = row.get("TimeStamp").getTimestampValue() / 1000;
+                long timeStamp = row.get(""+TIMESTAMP_NAME+"").getTimestampValue() / 1000;
                 // Riktig format, men i string
                 String formatedTimeStamp = getDateFormat().format(timeStamp);
 
-/*
-                // Checks for negative values and unresonable large values
-                if(variantValue > 0){ //&& variantValue < 5000000){
+                // Checks for negative values
+                if(variantValue > 0) {
                     // Adding the data to a list in order to sort through later
                     data.put(formatedTimeStamp, variantValue);
                 }
 
- */
-                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
                 }
@@ -243,7 +240,6 @@ public class DB {
             System.out.printf("Timestamp: \t%s\t\t\tkWh: \t%s\n",entry.getKey(),entry.getValue());
         }
 
-
         return sortedFinalResults;
     }
 
@@ -262,10 +258,6 @@ public class DB {
      */
     private static Map<String, String> getZeroPointDate() throws Exception{
 
-        // Initializing a date format in the data type DateTimeFormatter
-        // Required for iterating through the dates.
-        DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
-
         // Initializing the dates map to store the results
         Map<String, String> dates = new HashMap<>();
 
@@ -278,23 +270,36 @@ public class DB {
          */
 
 
+        // Defining extra parameters if required
+        String extraInputParameter = "";
+        if(LOCATION_ID == 124){
+            extraInputParameter += "AND CalculatedStart BETWEEN \"1990-01-01 00:00:00\" AND \"" + TODAYS_DATE + "\" ";
+        }
+        if(LOCATION_ID == 174){
+            // KILIN_ID starts at 0 not 1 in the database.
+            KILIN_ID -= 1;
+        }
+
         // Sqlstatement for Valåsen(124)
         final String sqlStatement =
-                        "SELECT MAX(Name) as DryingSchedule, MAX(KilnName) as Kiln_name, DryingStarted, Max(CalculatedStop) as CalculatedStop\n" +
-                        "FROM `sf-drying-optimization.124.int_dk_valmaticsdryingbatches_v2` \n" +
-                        "WHERE KilnName = 5 \n" +
-                        "AND DATE(DryingStarted) BETWEEN \"1990-08-17\" AND \"2022-08-17\"\n" +
-                        "AND DATE(CalculatedStop) BETWEEN \"1990-08-17\" AND \"2022-08-17\"\n" +
-                        "AND DATE(CalculatedStart) BETWEEN \"1990-08-17\" AND \"2022-08-17\"\n" +
-                        "Group by DryingStarted\n" +
-                        "Order by DryingStarted ASC";
+                        "SELECT MAX("+OTHER_PARAMETERS_NAME+") as DryingSchedule, MAX("+KILIN_NAME+") as Kiln_ID, " + START_DRYING_NAME + ", MAX("+STOP_DRYING_NAME+") as DryingCompleted " +
+                        "FROM `" + PROJECT_ID + "." + LOCATION_ID + "." + TABLE_NAME_VALMATICS + "` " +
+                        "WHERE " + KILIN_NAME + " = " + KILIN_ID + " " +
+                        "AND "+START_DRYING_NAME+" BETWEEN \"1990-01-01 00:00:00\" AND \"" + TODAYS_DATE + "\" " +
+                        "AND "+STOP_DRYING_NAME+" BETWEEN \"1990-01-01 00:00:00\" AND \"" + TODAYS_DATE + "\" " +
+                                extraInputParameter +
+                        "Group by "+ START_DRYING_NAME + " " +
+                        "Order by "+ START_DRYING_NAME + " ASC " +
+                        "LIMIT " + LIMIT;
+
+        System.out.println(sqlStatement);
 
 
         /*
         // Sqlstatement for Årjang(174)
         final String sqlStatement =
                         "SELECT MAX(Name) as DryingSchedule, MAX(KilinId)+1 as KilnName, DryingStarted, Max(DryingCompleted) as DryingCompleted\n" +
-                        "FROM `sf-drying-optimization.174.int_dk_valmaticsdryingbatches` \n" +
+                        "FROM `" + PROJECT_ID + "." + LOCATION_ID + "." + TABLE_NAME_VALMATICS + "` " +
                         "WHERE KilinId = 16  \n" +
                         "AND DATE(DryingStarted) BETWEEN \"1990-08-17\" AND \"2022-08-17\"\n" +
                         "AND DATE(DryingCompleted) BETWEEN \"1990-08-17\" AND \"2022-08-17\"\n" +
@@ -314,17 +319,26 @@ public class DB {
             String formatedInTidTork = "";
             String formatedUtTidTork = "";
 
+            //System.out.println("Start: "+row.get("DryingStarted").getTimestampValue());
+            //System.out.println("Stop: "+row.get("DryingCompleted").getTimestampValue());
+
+
             // Retrieving the data
             // DryingStarted:
             if(!row.get("DryingStarted").isNull()){
+
                 // Check if response is given in millis
-                if(row.get("DryingStarted").getValue() instanceof Integer) {
-                    long InTidTorkLong = row.get("DryingStarted").getTimestampValue()/1000;
+                try{
+                    long doubleValue = row.get("DryingStarted").getTimestampValue();
+                    long InTidTorkLong = doubleValue/1000;
                     // Formating the data from long to a string in the correct date format
                     formatedInTidTork = getDateFormat().format(InTidTorkLong);
-                }
-                // Checks if response is given in a string date format
-                else if(row.get("DryingStarted").getValue() instanceof String) {
+                    //System.out.println("LONG!!@@@@");
+                } catch(NumberFormatException e){
+                    //not long value, must be of type string
+
+                    //System.out.println("Must be a string!!@@@@");
+
                     // stores the value
                     String value = (String) row.get("DryingStarted").getValue();
                     // Splits the string based on 'T'
@@ -332,41 +346,34 @@ public class DB {
                     // Combines the values into a new format
                     formatedInTidTork = splitValue[0]+" "+splitValue[1];
                 }
-            }
 
-            // CalculatedStop:
-            // DryingCompleted:
-            if(!row.get("CalculatedStop").isNull()){
-                // Check if response is given in millis
-                if(row.get("CalculatedStop").getValue() instanceof Integer) {
-                    long utTidTorkLong = row.get("CalculatedStop").getTimestampValue()/1000;
-                    // Formating the data from long to a string in the correct date format
-                    formatedUtTidTork = getDateFormat().format(utTidTorkLong);
-                }
-                else if(row.get("CalculatedStop").getValue() instanceof String) {
-                    // stores the value
-                    String value = (String) row.get("CalculatedStop").getValue();
-                    // Splits the string based on 'T'
-                    String[] splitValue = value.split("T");
-                    // Combines the values into a new format
-                    formatedUtTidTork = splitValue[0]+" "+splitValue[1];
-                }
-            }
+                // Checks if response is given in a string date format
+                //if(row.get("DryingStarted").getValue().equals(Long.parseLong(row.get("DryingStarted").getValue().toString()))) {
 
-            System.out.println(formatedInTidTork);
-            System.out.println(formatedUtTidTork+"\n");
 
-            /*
+            }
+
             // CalculatedStop:
             // DryingCompleted:
-            if(!row.get("CalculatedStop").isNull()){
-                long utTidTorkLong = row.get("CalculatedStop").getTimestampValue()/1000;
+            // Check if response is given in millis
+            try{
+                long doubleValue = row.get("DryingCompleted").getTimestampValue();
+                long utTidTorkLong = doubleValue/1000;
                 // Formating the data from long to a string in the correct date format
                 formatedUtTidTork = getDateFormat().format(utTidTorkLong);
-            } else {
-                formatedUtTidTork = "";
+            } catch(NumberFormatException e) {
+                //not long value, must be of type string
+
+                // stores the value
+                String value = (String) row.get("DryingCompleted").getValue();
+                // Splits the string based on 'T'
+                String[] splitValue = value.split("T");
+                // Combines the values into a new format
+                formatedUtTidTork = splitValue[0] + " " + splitValue[1];
             }
-             */
+
+            //System.out.println("Inn formated: "+formatedInTidTork);
+            //System.out.println("Ut formated: "+formatedUtTidTork+"\n");
 
             // Checks if intidtork or outtidtork is empty, if so they are ignored and not added to the list
             if (!formatedInTidTork.isEmpty() && !formatedUtTidTork.isEmpty()){
@@ -375,7 +382,7 @@ public class DB {
             }
             //System.out.printf("%s\t\t\t%s\n",formatedInTidTork,formatedUtTidTork);
         }
-        System.out.printf("Size of dates: %s\n", dates.size());
+        System.out.printf("Size of dates: %s\n\n", dates.size());
 
         // Returns a treemap that sorts the dates incrementally
         return new TreeMap<>(dates);
diff --git a/src/main/java/com/application/GUI/Input.java b/src/main/java/com/application/GUI/Input.java
new file mode 100644
index 0000000000000000000000000000000000000000..5f948f1745dd6ed893d8aa28eecba15979332ecc
--- /dev/null
+++ b/src/main/java/com/application/GUI/Input.java
@@ -0,0 +1,52 @@
+package com.application.GUI;
+
+import javafx.geometry.Pos;
+import javafx.scene.*;
+import javafx.scene.control.*;
+import javafx.scene.layout.*;
+import javafx.stage.*;
+
+
+/**
+ * This class handles the popup input window
+ */
+public class Input {
+
+    public static void display()
+    {
+        Stage popupwindow=new Stage();
+
+        popupwindow.initModality(Modality.APPLICATION_MODAL);
+        popupwindow.setTitle("Input Parameters");
+
+
+        Label inputLabel= new Label("Input");
+        inputLabel.setAlignment(Pos.TOP_CENTER);
+
+
+        Button close= new Button("Close this pop up window");
+        close.setAlignment(Pos.BOTTOM_CENTER);
+
+        close.setOnAction(e -> popupwindow.close());
+
+
+
+        BorderPane layout= new BorderPane();
+        //layout.set(inputLabel);
+        //layout.setCenter();
+        //layout.setBottom(close);
+
+
+
+        layout.getChildren().addAll(inputLabel, close);
+
+
+        Scene scene1= new Scene(layout, 300, 250);
+
+        popupwindow.setScene(scene1);
+
+        popupwindow.showAndWait();
+
+    }
+
+}
diff --git a/src/main/java/com/application/Main.java b/src/main/java/com/application/Main.java
index 38ca17b63fdd5e2f0899c012690ddeb37180f705..73d3dfc5d5a202bb73c4bbe5e1fd759a1d3e6881 100644
--- a/src/main/java/com/application/Main.java
+++ b/src/main/java/com/application/Main.java
@@ -1,9 +1,9 @@
 package com.application;
 
 import com.application.DB.DB;
-
+import com.application.GUI.Input;
 import com.application.GUI.RingProgressIndicator;
-import com.sun.corba.se.spi.orbutil.threadpool.Work;
+
 import javafx.application.Application;
 import javafx.application.Platform;
 import javafx.scene.chart.LineChart;
@@ -133,6 +133,7 @@ public class Main extends Application {
         Menu menuEdit = new Menu("Edit");
         Menu menuHelp = new Menu("Help");
 
+
         // Adding the menus to the menubar
         menuBar.getMenus().add(menuFile);
         menuBar.getMenus().add(menuEdit);
@@ -155,6 +156,7 @@ public class Main extends Application {
         TextField treeSpeciesText = new TextField();
         treeSpeciesText.setId("sideBarLabelText");
         treeSpeciesText.setPromptText("Bjørk");
+        treeSpeciesText.getText();
 
         Label dimensionsLabel = new Label("Width x Height");
         dimensionsLabel.setId("sideBarLabelText");
@@ -176,6 +178,7 @@ public class Main extends Application {
 
         Button finish = new Button("Finish");
         finish.setId("sideBarButtonFinish");
+        finish.setOnAction(e -> Input.display());
 
         // Creating the circular progressbar
         RingProgressIndicator ringProgressIndicator = new RingProgressIndicator();
diff --git a/target/classes/com/application/DB/Constants.class b/target/classes/com/application/DB/Constants.class
new file mode 100644
index 0000000000000000000000000000000000000000..fb8b19188b18e5a1db449153c03e34c3e6da09c9
Binary files /dev/null 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 30cd375022bc63510dd2aad4cd576d38dced7e46..b64f31c04a61860d9b2e4ac3a60b4f114f3d1935 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/Main$1WorkerThread.class b/target/classes/com/application/Main$1WorkerThread.class
index fc1cb79295b938a5ba6bc65d216611f6e1d0be64..9abb12eca1a252de3954b0675b49e8a0237e772b 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 23a916a35e825fce2f8a9fed85331c992bbed12d..0d5b4b05146df4bdf444faab24858fda26ff690c 100644
Binary files a/target/classes/com/application/Main.class and b/target/classes/com/application/Main.class differ