diff --git a/AngularApp/prototype/src/app/api.service.ts b/AngularApp/prototype/src/app/api.service.ts
index 2410c4161ab873db2336bb645cb7a999f790d0ba..3ee03f12ec97a4a5c6c8069e1346142c419b4dd9 100644
--- a/AngularApp/prototype/src/app/api.service.ts
+++ b/AngularApp/prototype/src/app/api.service.ts
@@ -61,14 +61,14 @@ export class ApiService {
   }
 
   // Find candidates using LSH with weights
-  async lshUpdate(query, hashFunctions, parameters): Promise<LshData> {
+  async lshUpdate(query, weights, parameters): Promise<LshData> {
     const response = await fetch('http://127.0.0.1:5000/update', {
       method: 'POST',
       headers: {
         'Accept': 'application/json',
         'Content-Type': 'application/json'
       },
-      body: new Blob( [ JSON.stringify({query, hash_functions: hashFunctions, parameters}) ], { type: 'text/plain' } )
+      body: new Blob( [ JSON.stringify({query, weights, parameters}) ], { type: 'text/plain' } )
     });
     return await response.json();
   }
diff --git a/AngularApp/prototype/src/app/state.service.ts b/AngularApp/prototype/src/app/state.service.ts
index fc5e78aa4ee885de1ad40d05f237fc7b94474bb3..30dd3a06248da5234fba54b21f5887387b1a84bd 100644
--- a/AngularApp/prototype/src/app/state.service.ts
+++ b/AngularApp/prototype/src/app/state.service.ts
@@ -67,7 +67,7 @@ export class StateService {
   }
 
   async update(): Promise<void> {
-    this.lshData = await this.api.lshUpdate(this._queryWindow, [], this._parameters);
+    this.lshData = await this.api.lshUpdate(this._queryWindow, [], this.lshData.parameters);
     this.createTable();
   }
 
@@ -109,6 +109,7 @@ export class StateService {
   }
 
   public set lshData(v: LshData) {
+    console.log(v);
     this._lshData = v;
   }
 
@@ -126,6 +127,7 @@ export class StateService {
   }
 
   public set table(v: {[bucket: string]: number[]}) {
+    console.log(v);
     this._table = v;
     this.onNewTable.emit();
   }
diff --git a/Flaskserver/.idea/workspace.xml b/Flaskserver/.idea/workspace.xml
index 0aab67396ff47a17bb082b649001411234939d28..67eb01f32c371abe0bca8c2e1776ff6ced252e02 100644
--- a/Flaskserver/.idea/workspace.xml
+++ b/Flaskserver/.idea/workspace.xml
@@ -20,20 +20,13 @@
   </component>
   <component name="ChangeListManager">
     <list default="true" id="556080ba-825c-4b55-a92a-867a4df4fb32" name="Default Changelist" comment="">
-      <change afterPath="$PROJECT_DIR$/../AngularApp/prototype/src/app/state.service.ts" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/../AngularApp/prototype/src/app/api.service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../AngularApp/prototype/src/app/api.service.ts" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/../AngularApp/prototype/src/app/cache.service.ts" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/../AngularApp/prototype/src/app/labeling-window/labeling-window.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/../AngularApp/prototype/src/app/labeling-window/labeling-window.component.html" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/../AngularApp/prototype/src/app/labeling-window/labeling-window.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../AngularApp/prototype/src/app/labeling-window/labeling-window.component.ts" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/../AngularApp/prototype/src/app/labels/labels.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../AngularApp/prototype/src/app/labels/labels.component.ts" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/../AngularApp/prototype/src/app/main/main.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../AngularApp/prototype/src/app/main/main.component.ts" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/../AngularApp/prototype/src/app/overview-window/overview-window.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../AngularApp/prototype/src/app/overview-window/overview-window.component.ts" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/../AngularApp/prototype/src/app/progress-view/progress-view.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../AngularApp/prototype/src/app/progress-view/progress-view.component.ts" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/../AngularApp/prototype/src/app/query-window/query-window.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../AngularApp/prototype/src/app/query-window/query-window.component.ts" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/../AngularApp/prototype/src/app/settings/settings.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../AngularApp/prototype/src/app/settings/settings.component.ts" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/../AngularApp/prototype/src/app/table-overview/table-overview.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/../AngularApp/prototype/src/app/table-overview/table-overview.component.html" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/../AngularApp/prototype/src/app/table-overview/table-overview.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../AngularApp/prototype/src/app/table-overview/table-overview.component.ts" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/../AngularApp/prototype/src/app/state.service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../AngularApp/prototype/src/app/state.service.ts" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/_lsh.cpython-38-x86_64-linux-gnu.so" beforeDir="false" afterPath="$PROJECT_DIR$/_lsh.cpython-38-x86_64-linux-gnu.so" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/build/lib.linux-x86_64-3.8/_lsh.cpython-38-x86_64-linux-gnu.so" beforeDir="false" afterPath="$PROJECT_DIR$/build/lib.linux-x86_64-3.8/_lsh.cpython-38-x86_64-linux-gnu.so" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/build/temp.linux-x86_64-3.8/Dylan/lsh-fast/_lsh.o" beforeDir="false" afterPath="$PROJECT_DIR$/build/temp.linux-x86_64-3.8/Dylan/lsh-fast/_lsh.o" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/build/temp.linux-x86_64-3.8/Dylan/lsh-fast/lsh.o" beforeDir="false" afterPath="$PROJECT_DIR$/build/temp.linux-x86_64-3.8/Dylan/lsh-fast/lsh.o" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
diff --git a/Flaskserver/__pycache__/main.cpython-38.pyc b/Flaskserver/__pycache__/main.cpython-38.pyc
index 4b9f0769f536e6877c95aab63a760e0e277290ee..11c141b681dfc83e4fcc0aa78671b3c2d31c6a86 100644
Binary files a/Flaskserver/__pycache__/main.cpython-38.pyc and b/Flaskserver/__pycache__/main.cpython-38.pyc differ
diff --git a/Flaskserver/_lsh.cpython-38-x86_64-linux-gnu.so b/Flaskserver/_lsh.cpython-38-x86_64-linux-gnu.so
index 72d47752ebd71160be4800f52e4edff35962608f..c158fb21063e1cf4ccf1222454271afee9e416b3 100755
Binary files a/Flaskserver/_lsh.cpython-38-x86_64-linux-gnu.so and b/Flaskserver/_lsh.cpython-38-x86_64-linux-gnu.so differ
diff --git a/Flaskserver/build/lib.linux-x86_64-3.8/_lsh.cpython-38-x86_64-linux-gnu.so b/Flaskserver/build/lib.linux-x86_64-3.8/_lsh.cpython-38-x86_64-linux-gnu.so
index 72d47752ebd71160be4800f52e4edff35962608f..c158fb21063e1cf4ccf1222454271afee9e416b3 100755
Binary files a/Flaskserver/build/lib.linux-x86_64-3.8/_lsh.cpython-38-x86_64-linux-gnu.so and b/Flaskserver/build/lib.linux-x86_64-3.8/_lsh.cpython-38-x86_64-linux-gnu.so differ
diff --git a/Flaskserver/build/temp.linux-x86_64-3.8/Dylan/lsh-fast/_lsh.o b/Flaskserver/build/temp.linux-x86_64-3.8/Dylan/lsh-fast/_lsh.o
index 49663f279da6e9bfe8ee91d8bdb2c65b4ee5412a..40338ac5c1c9971b204a7abb51b5745d2a1c0e56 100644
Binary files a/Flaskserver/build/temp.linux-x86_64-3.8/Dylan/lsh-fast/_lsh.o and b/Flaskserver/build/temp.linux-x86_64-3.8/Dylan/lsh-fast/_lsh.o differ
diff --git a/Flaskserver/build/temp.linux-x86_64-3.8/Dylan/lsh-fast/lsh.o b/Flaskserver/build/temp.linux-x86_64-3.8/Dylan/lsh-fast/lsh.o
index b9348bc3b5623b095f426a8e9edb4e5e00afac24..fe89377f2e34cee6c106a3ddc297003386ba16de 100644
Binary files a/Flaskserver/build/temp.linux-x86_64-3.8/Dylan/lsh-fast/lsh.o and b/Flaskserver/build/temp.linux-x86_64-3.8/Dylan/lsh-fast/lsh.o differ
diff --git a/Flaskserver/main.py b/Flaskserver/main.py
index 3b4ab61b55bd69a09470ab01ce8bb44cd9673467..4d4f3a71a822a196c4bf76c1ab84332ee53cf8ff 100644
--- a/Flaskserver/main.py
+++ b/Flaskserver/main.py
@@ -101,16 +101,13 @@ def update():
     data = np.load('processed-data.npy')
     data = np.reshape(data, (len(data), len(data[0]), 1))
     # data = np.repeat(data, repeats=1, axis=2)
-    hash_functions = raw_data["hash_functions"]
-    hash_functions = np.array(hash_functions, dtype='double')
-    hash_functions = (hash_functions - np.min(hash_functions)) / np.ptp(hash_functions)
-    hash_functions = np.reshape(hash_functions, (len(data[0]), 1))
+    weights = raw_data["weights"]
     query = raw_data["query"]
     query = np.reshape(query, (len(query), 1))
     # query = np.repeat(query, repeats=1, axis=1)
     parameters = raw_data["parameters"]
 
-    candidates, distances, hf = _lsh.lsh(data, query, parameters[0], parameters[1], parameters[2], hash_functions)
+    candidates, distances, hf = _lsh.lsh(data, query, parameters[0], parameters[1], parameters[2])
     response = {
         "hash_functions": hf.tolist(),
         "distances": distances.tolist(),
@@ -231,83 +228,32 @@ def debug_test_lsh():
     create_windows()
     query_n = 80503
     data = np.load('processed-data.npy')
-    query = performDBA(data[[80503, 11514]])
+    query = data[query_n] # performDBA(data[[80503, 11514]])
     query = np.reshape(query, (len(data[0]), 1))
     data= np.array(data, dtype='double')
     data = np.reshape(data, (len(data), len(data[0]), 1))
     data = np.repeat(data, repeats=1, axis=2)
-    # query = data[query_n]
 
     candidates, distances, hf = _lsh.lsh(data, query, r, a, sd)
     print(repr(candidates[0:20]))
     print(distances[0:10])
-    print(np.where(candidates == 80503))
-    print(np.where(candidates == 11514))
 
     data = np.load('processed-data.npy')
     query = data[query_n]
-    distances = [_ucrdtw.ucrdtw(window, query, 0.05 * 120, False)[1] for window in data]
+    print(data[0])
+    distances = [_ucrdtw.ucrdtw(window, query, 0.05, False)[1] for window in data]
+    sorted_distances = sorted(distances)
+    print(sorted_distances[0:10])
     topk_dtw = sorted(range(len(distances)), key=lambda k: distances[k])
     print(topk_dtw[0:10])
-    #
-    # for candidate in candidates[0:20]:
-    #     print(_ucrdtw.ucrdtw(data[candidate], query, 0.05, False)[1])
-    #
+
     # # distances_ed = [distance.euclidean(query, window) for window in data]
     # # topk_ed = sorted(range(len(distances_ed)), key=lambda k: distances_ed[k])
     #
-    # accuracy = 0
-    # for index in topk_dtw[0:20]:
-    #     if index in candidates[0:20]:
-    #         accuracy += 1
-    # print(accuracy)
-    #
-    # accuracy = 0
-    # for index in topk_dtw[0:20]:
-    #     if index in candidates[0:50]:
-    #         accuracy += 1
-    # print(accuracy)
-    #
-    # # accuracy = 0
-    # # for index in topk_ed[0:20]:
-    # #     if index in candidates[0:20]:
-    # #         accuracy += 1
-    # # print(accuracy)
-    # #
-    # # accuracy = 0
-    # # for index in topk_ed[0:50]:
-    # #     if index in candidates[0:50]:
-    # #         accuracy += 1
-    # # print(accuracy)
-    #
-    # accuracy = 0
-    # for index in topk_dtw[0:50]:
-    #     if index in candidates[0:1000]:
-    #         accuracy += 1
-    # print(accuracy)
-    #
-    # accuracy = 0
-    # for index in topk_dtw[0:50]:
-    #     if index in candidates[0:5000]:
-    #         accuracy += 1
-    # print(accuracy)
-    #
-    # accuracy = 0
-    # for index in topk_dtw[0:50]:
-    #     if index in candidates[0:10000]:
-    #         accuracy += 1
-    # print(accuracy)
-    #
-    # accuracy = 0
-    # for index in topk_dtw[0:50]:
-    #     if index in candidates[0:50000]:
-    #         accuracy += 1
-    # print(accuracy)
-    #
-    # accuracy = 0
-    # for index in topk_dtw[0:50]:
-    #     if index in candidates:
-    #         accuracy += 1
-    # print(accuracy)
+    accuracy = 0
+    for index in topk_dtw[0:20]:
+        if index in candidates[0:20]:
+            accuracy += 1
+    print(accuracy)
 
-# debug_test_lsh(r, a, sd)
\ No newline at end of file
+debug_test_lsh()
\ No newline at end of file
diff --git a/README.md b/README.md
index 4ce5d4a8dbcc87b7977c033db0d8a300a5ba15f0..e71b465004f5fc7e041d1583ff225c453dd069d7 100644
--- a/README.md
+++ b/README.md
@@ -17,3 +17,35 @@ Once these are installed on your computer, simply run *run-angular.bat* to set u
 and *run-flask.bat* to set up the server side API
 
 The client-side bat-file should automatically open your browser and connect to http://localhost:4200/
+
+# Documentation
+## GUI
+The GUI is an Angular framework. It consists of views (components) and a state (service). Every time an API call is done, the state will alter. Using hooks (EventEmitters), views can subscribe state variable changes and alter their view using the new value(s). The types of views is listed below.
+### Overview
+This view shows the entire dataset. When windows are labeled and candidates are generated, it should show the locations in this overview.
+### Query
+This view shows the current query.
+### Training
+This view shows the sampled candidates. In this view the user can label the samples as correct or incorrect. When the user is satisfied the labels will be updated and new samples will be generated.
+### Progress
+This view will show the progress of the learned classifier. It should show whether the classifier is getting better at understanding the desired pattern
+### Labels
+This view shows the currently labeled windows. The user should be able to change and delete labels in this view.
+### Settings
+This view shows the current parameters (e.g. window size)
+
+## API
+### /read-data
+This API call reads time series data from a file and returns the values and indices.
+### /create-windows
+This API call reads time series data and chunks it into windows. For now the windows are saved to a file locally.
+### /initialize
+This API call starts the first iteration of the LSH algorithm. First some essential parameters are calculated. Then the LSH algorithm is called. The API returns the candidates, distances and hash functions.
+### /update
+This API call runs the LSH algorithm with weights that will manipulate the hashing functions. The API returns the candidates, distances and hash functions.
+### /query
+This API will return the query data based on the provided window indices. If only one index is given, the API call will return the window values according to the index. If multiple indices are given, the DTW-based average of the window values according to the indices is returned.
+### /window
+This API simply returns the window values according to the index.
+### /table-info
+This API call will return extra info needed for the progression view. The input will be a subdivision of windows into buckets, and for each bucket the prototype (average) will be calculated + the distances between each prototype.