diff --git a/actions/delete-unused.php b/actions/delete-unused.php
new file mode 100644
index 0000000..60231ef
--- /dev/null
+++ b/actions/delete-unused.php
@@ -0,0 +1,45 @@
+&1", $count, $return);
+
+ if($return !== 0){
+ $message = 'Could not execute deletion command: "' . $count[0] . '"';
+ break;
+ }
+
+ if(intval($count[0]) == 0){
+ $output = "";
+ exec($tmsu . "delete " . $tag, $output);
+
+ $deleted_tags .= $tag . " ";
+ }
+}
+
+if($deleted_tags !== "") $message = "Deleted unused tags: (" . $deleted_tags . ")";
+
+array_push($_SESSION["msg"], $message);
+
+if(isset($_GET["_back"])){
+ header("Location: " . $_GET["_back"]);
+}
+else{
+ //header("Location: " . $BASE_PATH . "/?msg[0]=" , $message);
+ header("Location: " . $BASE_PATH . "/");}
diff --git a/index.php b/index.php
index ea6e073..678f79d 100644
--- a/index.php
+++ b/index.php
@@ -33,9 +33,6 @@
exec($tmsu . "files -c '" . addcslashes($tag . $exclude_query, '(..)') . "'", $count);
echo("(" . $count[0] .") " . $tag .", ");
}
-
- echo("
");
- echo("<");
?>