 
   if(space == -1) runCommand(0,bufSize);
   else{
-    if(equals(0,space,"DEFAULTDELAY",12) || equals(0,space,"DEFAULT_DELAY",13)) defaultDelay = getInt(space);
-    else if(equals(0,space,"DEFAULTCHARDELAY",16) || equals(0,space,"DEFAULT_CHAR_DELAY",18)) defaultCharDelay = getInt(space);
-    else if(equals(0,space,"DELAY",5)) delay(getInt(space));
-    else if(equals(0,space,"STRING",6)){
+    if(equalsBuffer(0,space,"DEFAULTDELAY") || equalsBuffer(0,space,"DEFAULT_DELAY")) defaultDelay = getInt(buf,space);
+    else if(equalsBuffer(0,space,"DEFAULTCHARDELAY") || equalsBuffer(0,space,"DEFAULT_CHAR_DELAY")) defaultCharDelay = getInt(buf,space);
+    else if(equalsBuffer(0,space,"DELAY")) delay(getInt(buf,space));
+    else if(equalsBuffer(0,space,"STRING")){
       for(int i=space+1;i<bufSize;i++) KeyboardWrite(buf[i]);
-    }else if(equals(0,space,"REPEAT",6)){
-      int runs = getInt(space);
-      strncpy(buf, last, lastSize);
-      bufSize = lastSize;
-      for(int i=0;i<runs;i++){
-        runLine();
-      }
-    }
-    else if(equals(0,space,"REM",3)){}
+    }
+    else if(equalsBuffer(0,space,"REM") || equalsBuffer(0,space,"REPEAT")){}
     else{
       runCommand(0,space);
       while(space >= 0 && space < bufSize){


  payload = SD.open(scriptName);
  if(!payload){
    #ifdef debug 
      Serial.println("couldn't find script: '"+String(scriptName)+"'");
    #endif
    return;
  }else{
    Keyboard.begin();

/*
  ==============================================================
    Copyright (c) 2017 Seytonic, Spacehuhn (Licensed under MIT)
      For more information see: github.com/seytonic/malduino
  ==============================================================
*/

#include <SPI.h>
#include <SD.h>
#include "Keyboard.h"

#define debug true // <-- uncomment to turn serial output on
#define CSpin 4 //Chip-Select of the SD-Card reader
#define ledPin 3
#define blinkInterval 50
