-                        
-                        
+                        
+                        
                         
diff --git a/dashboard_static/js/code.js b/dashboard_static/js/code.js
index 53e2b0c..64747fb 100644
--- a/dashboard_static/js/code.js
+++ b/dashboard_static/js/code.js
@@ -94,26 +94,41 @@ function searchForWords(searchWords, tweets){
     return filteredTweets.reverse()
 }
 
-function sortTweets(tweets, likesDes=null, retweetsDes=null, repliesDes=null, dateDes=null){
-    if(likesDes && likesDes!=null){
-        tweets.sort(function(a,b){return b.favorite_count-a.favorite_count})
-    } else if (!likesDes && likesDes!=null){
-        tweets.sort(function(a,b){return a.favorite_count-b.favorite_count})
+function sortTweets(tweets, sort){
+    if(typeof sort.sortby == 'undefined'){
+        return tweets
     }
-    if(retweetsDes && retweetsDes!=null){
-        tweets.sort(function(a,b){return b.retweet_count-a.retweet_count})
-    } else if (!retweetsDes && retweetsDes!=null){
-        tweets.sort(function(a,b){return a.retweet_count-b.retweet_count})
+    if(typeof sort.order == 'undefined'){
+        sort.order = 'asc'
     }
-    if(repliesDes && repliesDes!=null){
-        tweets.sort(function(a,b){return b.reply_count-a.reply_count})
-    } else if (!repliesDes && repliesDes!=null){
-        tweets.sort(function(a,b){return a.reply_count-b.reply_count})
+
+    if(sort.sortby == "likes"){
+        if(sort.order == 'asc'){
+            tweets.sort(function(a,b){return b.favorite_count-a.favorite_count})
+        } else{
+            tweets.sort(function(a,b){return a.favorite_count-b.favorite_count})
+        }
     }
-    if(dateDes && dateDes!=null){
-        tweets.sort(function(a,b){return Date(b.created_at)-Date(a.reply_count)})
-    } else if (!dateDes && dateDes!=null){
-        tweets.sort(function(a,b){return Date(a.created_at)-Date(b.reply_count)})
+    if(sort.sortby == "retweets"){
+        if(sort.order == 'asc'){
+            tweets.sort(function(a,b){return b.retweet_count-a.retweet_count})
+        } else{
+            tweets.sort(function(a,b){return a.retweet_count-b.retweet_count})
+        }
+    }
+    if(sort.sortby == "replies"){
+        if(sort.order == 'asc'){
+            tweets.sort(function(a,b){return b.reply_count-a.reply_count})
+        } else {
+            tweets.sort(function(a,b){return a.reply_count-b.reply_count})
+        }
+    }
+    if (sort.sortby == "date"){
+        if(sort.order == 'asc'){
+            tweets.sort(function(a,b){return Date(b.created_at)-Date(a.reply_count)})
+        } else{
+            tweets.sort(function(a,b){return Date(a.created_at)-Date(b.reply_count)})
+        }
     }
     return tweets
 }
diff --git a/dashboard_static/js/events.js b/dashboard_static/js/events.js
index 7ed73fd..d7a0fab 100644
--- a/dashboard_static/js/events.js
+++ b/dashboard_static/js/events.js
@@ -80,7 +80,7 @@ $(window).on("filter", function() {
     tweets = JSON.parse(tweets);
     console.log(tweets.length)
     tweets = filterTweets(tweets, filters.blockedWords, filters.searchedWords.concat(filters.sports), filters.sorted, filters.order);
-    tweets = sortTweets(tweets);
+    tweets = sortTweets(tweets, [filters.sorted, filters.order]);
     var displayTweets = tweets.reverse().slice(0, 20).reverse();
     for (i = 0; i < 19; i++){
         console.log("FDS")
@@ -93,11 +93,28 @@ $(window).on("filter", function() {
 $(".order-btn").on("click", function() {
     if($(this).html() == "arrow_downward") {    // Descending to ascending
         $(this).html("arrow_upward")
-        // trigger an event called ascending
-        $(window).trigger("ascending")
+        filters.order = 'asc'
     } else {    // Ascending to descending
         $(this).html("arrow_downward")
-        // trigger an event called descending
-        $(window).trigger("descending")
+        filters.order = 'desc'
     }
+    $(window).trigger("filter")
 })
+
+function updateSearched(searched){
+    searched = searched.split(",");
+    filters.searchedWords = searched;
+    $(window).trigger("filter");
+}
+
+function updateBlocked(blocked){
+    blocked = blocked.split(",");
+    filters.blockedWords = blocked;
+    $(window).trigger("filter");
+}
+
+function updateSort(sort){
+    sortarray = []
+    filters.sorted = sort;
+    $(window).trigger("filter");
+}
\ No newline at end of file
diff --git a/eca/__pycache__/arff.cpython-310.pyc b/eca/__pycache__/arff.cpython-310.pyc
index 1516621..f36aef8 100644
Binary files a/eca/__pycache__/arff.cpython-310.pyc and b/eca/__pycache__/arff.cpython-310.pyc differ
diff --git a/eca/__pycache__/generators.cpython-310.pyc b/eca/__pycache__/generators.cpython-310.pyc
index 155bc4d..c475398 100644
Binary files a/eca/__pycache__/generators.cpython-310.pyc and b/eca/__pycache__/generators.cpython-310.pyc differ