   //set time (unix timestamp)
   pos = req.indexOf("ST=");
   if (pos > 0) {
-    setTime(req.substring(pos+3).toInt());
+    setTime(getNumVal(&req, pos));
   }
    
   //set countdown goal (unix timestamp)
   pos = req.indexOf("CT=");
   if (pos > 0) {
-    countdownTime = req.substring(pos+3).toInt();
+    countdownTime = getNumVal(&req, pos);
     if (countdownTime - now() > 0) countdownOverTriggered = false;
   }
    
   //set presets
   pos = req.indexOf("P1="); //sets first preset for cycle
-  if (pos > 0) presetCycleMin = req.substring(pos + 3).toInt();
+  if (pos > 0) presetCycleMin = getNumVal(&req, pos);
   
   pos = req.indexOf("P2="); //sets last preset for cycle
-  if (pos > 0) presetCycleMax = req.substring(pos + 3).toInt();
+  if (pos > 0) presetCycleMax = getNumVal(&req, pos);
    
   if (req.indexOf("CY=") > 0) //preset cycle
   {

  //set to random hue SR=0->1st SR=1->2nd
  pos = req.indexOf("SR");
  if (pos > 0) {
    _setRandomColor(req.substring(pos + 3).toInt());
  }
  //set 2nd to 1st
  pos = req.indexOf("SP");

  if (subPage == 2) strip.init(useRGBW,ledCount,skipFirstLed);
}


//helper to get int value at a position in string
int getNumVal(String* req, uint16_t pos)
{
  return req->substring(pos + 3).toInt();
}


//HTTP API request parser
bool handleSet(String req)
{
  if (!(req.indexOf("win") >= 0)) return false;
