diff --git a/public_html/valuestore/browse.php b/public_html/valuestore/browse.php
index f4782eccde0f3b7e0bfe7e57b71a566ae74f3173..4871058a0c25f81e5d80f4f987f9dcffd9f56348 100644
--- a/public_html/valuestore/browse.php
+++ b/public_html/valuestore/browse.php
@@ -115,19 +115,33 @@ $sTableHead='';
 if(is_array($aData) && count($aData)){
     // echo '<pre>' . print_r($aData, 1);
     foreach ($aData as $aRow){
-        $sUrl='index.php?action=get&project='.$aRow['project'].'&package='.$aRow['package'].'&phase='.$aRow['phase'].'&host='.$aRow['host'].'&variable='.$aRow['variable'].'';
-        $sTable.='<tr onclick="location.href=\''.$sUrl.'\'">';
+        $sItemUrl='index.php?project='.$aRow['project'].'&package='.$aRow['package'].'&phase='.$aRow['phase'].'&host='.$aRow['host'].'&variable='.$aRow['variable'].'';
+        // $sTable.='<tr onclick="location.href=\''.$sUrl.'\'">';
+        $sTable.='<tr>';
         foreach ($aRow as $sKey=>$sValue){
             // $sTable.='<td class="'.$sKey.'"><a href="'.$sUrl.'">'.$sValue.'</a></td>';
             $sTable.='<td class="'.$sKey.'">'.htmlentities($sValue).'</td>';
         }
-        $sTable.='</tr>';
+        $sTable.='<td>'
+                . '<button onclick="location.href=\''.$sItemUrl.'&action=get\'">View</button>'
+                . '<form method="POST" action="'.$sItemUrl.'">'
+                    . '<input type="hidden" name="action" value="delete">'
+                    . '<button>Delete</button>'
+                . '</form>'
+                . '</td>'
+                . '</tr>';
         
     }
     foreach (array_keys($aRow) as $sKey){
         $sTableHead.='<th class="'.$sKey.'">'.$sKey.'</th>';
     }
-    $sOut.='<table id="tbldata"><thead>'
+    $sOut.=''
+            . '<form method="POST" action="index.php">'
+                . '<input type="hidden" name="action" value="cleanup">'
+                . '<button>Cleanup</button>'
+            . '</form>'
+            
+            . '<table id="tbldata"><thead>'
             . '<tr>'.$sTableHead. '</tr>'
             . '</thead>'
             . '<tbody>'.$sTable.'</tbody></table>';
diff --git a/public_html/valuestore/classes/valuestore.class.php b/public_html/valuestore/classes/valuestore.class.php
index 06a7d5a04d38556dd8d3d9e4125b735790880bfb..65d028ac41b59afcb6ab2c76c378583511b9eca5 100644
--- a/public_html/valuestore/classes/valuestore.class.php
+++ b/public_html/valuestore/classes/valuestore.class.php
@@ -92,10 +92,10 @@ class valuestore {
         // cache dir is hardcoded to versions directory :-/
         $this->_dbfile = __DIR__ . '/../data/versioncache.db';
         
-        if (!file_exists($this->_dbfile)) {
+        $this->_oDB = new PDO("sqlite:" . $this->_dbfile);
+        if (!file_exists($this->_dbfile) || !filesize($this->_dbfile)) {
             $this->_createDb();
         }
-        $this->_oDB = new PDO("sqlite:" . $this->_dbfile);
     }
     /**
      * add a log messsage
@@ -445,14 +445,23 @@ class valuestore {
     
     /**
      * cleanup value store
+     * @param integer  $iTtl  optional: max age in seconds of items to keep; 0 to delete all; default is 1 day
      * @return boolean
      */
-    public function cleanup(){
-        if (!$this->_iTTL){
-            return false;
+    public function cleanup($iTtl=false){
+        if ($iTtl===false){
+            $iTtl=$this->_iTTL;
         }
-        $sTtlDate=date("Y-m-d H:i:s", date("U") - $this->_iTTL );
-        $sSql="DELETE FROM `values` WHERE `time` < '$sTtlDate'";
+        $sTtlDate=date("Y-m-d H:i:s", date("U") - (int)$iTtl );
+        $sSql="DELETE FROM `values` WHERE `time` < '$sTtlDate' "
+            . ($this->sProject ? "AND project='"  . $this->sProject . "' " : "")
+            . ($this->sPackage ? "AND package='"  . $this->sPackage . "' " : "")
+            . ($this->sPhase   ? "AND phase='"    . $this->sPhase   . "' " : "")
+            . ($this->sPlace   ? "AND place='"    . $this->sPlace   . "' " : "")
+            . ($this->sHost    ? "AND host='"     . $this->sHost    . "' " : "")
+            . ($sVariable      ? "AND variable='" . $sVariable      . "' " : "")
+            ;
+        // die("$iTtl ... $sSql ... ABORT");
         $this->_makeQuery($sSql);
         $this->_makeQuery("vaccum;");
         return true;
@@ -478,7 +487,7 @@ class valuestore {
             . ($sVariable      ? "AND variable='" . $sVariable      . "' " : "")
             ;
         $sSql="DELETE FROM `values` WHERE $sWhere";
-        echo $sSql; 
+        // echo $sSql; 
         // return true;
         return $this->_makeQuery($sSql);
     }
diff --git a/public_html/valuestore/index.php b/public_html/valuestore/index.php
index e860ce9c19c39b0801b9e66cefc29f46656a96a4..43d172d928850002ba383b752885228fe1ce7ab6 100644
--- a/public_html/valuestore/index.php
+++ b/public_html/valuestore/index.php
@@ -24,8 +24,6 @@
  * 
  * 2017-04-07  hahn  first lines
  */
-
-
 // ----------------------------------------------------------------------
 // functions
 // ----------------------------------------------------------------------
@@ -50,14 +48,14 @@ function quit($sMessage) {
  * @return type
  */
 function getParam($sKey, $sRegex4Cleanup = false) {
-    $sValue=false;
+    $sValue = false;
     if (array_key_exists($sKey, $_GET)) {
-        $sValue=$_GET[$sKey];
+        $sValue = $_GET[$sKey];
     }
     if (array_key_exists($sKey, $_POST)) {
-        $sValue=$_POST[$sKey];
+        $sValue = $_POST[$sKey];
     }
-    if(!$sValue){
+    if (!$sValue) {
         return false;
     }
     $sReturn = $sRegex4Cleanup ? preg_replace($sRegex4Cleanup, '', $sValue) : $sValue;
@@ -71,24 +69,19 @@ function getParam($sKey, $sRegex4Cleanup = false) {
 // ----------------------------------------------------------------------
 // check required params
 // ----------------------------------------------------------------------
+/*
 if (!$_GET || !count($_GET)) {
     quit("no parameter was found.");
 }
+ */
 
 
-foreach (array("action") as $sKey) {
-    if (!array_key_exists($sKey, $_GET)) {
-        quit("value required: $sKey=");
-    }
-}
-
 // ----------------------------------------------------------------------
 // get vars
 // ----------------------------------------------------------------------
 
-
 $sAction = getParam('action', '/[^a-z]/');
-if ($sAction !== "delete" && $sAction !== "get" && $sAction !== "update") {
+if ($sAction !== "delete" && $sAction !== "get" && $sAction !== "update" && $sAction !== "cleanup") {
     quit("action is unknown or not implemented yet.");
 }
 
@@ -113,32 +106,38 @@ $sValue = getParam('value', '');
 require './classes/valuestore.class.php';
 
 $oVersion = new valuestore();
-$oVersion->setProject($sProject, $sPackage, $sPhase, $sPlace, $sHost);
 
 switch ($sAction) {
+    case 'cleanup':
+        $oVersion->cleanup();
+        echo "Cleanup was done.";
+        break;
     case 'delete':
-                if ($oVersion->deleteValues($sVarname)){
-                    
-                    echo "OK: ".print_r($oVersion->whereiam())." ($sVarname) was deleted.";
-                } else {
-                    echo "ERROR: update for $sVarname failed.";
-                }
-                break;
+        $oVersion->setProject($sProject, $sPackage, $sPhase, $sPlace, $sHost);
+        if ($oVersion->deleteValues($sVarname)) {
+
+            echo "OK: " . print_r($oVersion->whereiam()) . " ($sVarname) was deleted.";
+        } else {
+            echo "ERROR: update for $sVarname failed.";
+        }
+        break;
 
         break;
     case 'get':
+        $oVersion->setProject($sProject, $sPackage, $sPhase, $sPlace, $sHost);
         header('Content-Type: application/json');
         echo json_encode($oVersion->getVersion());
 
         break;
     case 'update':
+        $oVersion->setProject($sProject, $sPackage, $sPhase, $sPlace, $sHost);
         if (!$sVarname) {
             quit("ERROR: the update action requires a variable and a value.");
         }
         switch ($sVarname) {
             // case 'other-varname':
             case 'version':
-                if ($oVersion->updateVar($sVarname, $sValue)){
+                if ($oVersion->updateVar($sVarname, $sValue)) {
                     echo "OK: $sVarname was updated.";
                 } else {
                     echo "ERROR: update for $sVarname failed.";