   
     bool _hasPower, _inProgrammingMode;
 
+    void pushOutBits(int value, int count) {
+      for (int i = 0; i < count; i++) {
+        digitalWrite(PROGRAMMING_CLOCK_PIN, HIGH);
+        micDelay(PROGRAMMING_MODE_CLOCK_CYCLE_DELAY);
+        digitalWrite(PROGRAMMING_DATA_PIN, (value & 1) == 1 ? HIGH : LOW);
+        micDelay(PROGRAMMING_MODE_CLOCK_CYCLE_DELAY);
+        digitalWrite(PROGRAMMING_CLOCK_PIN, LOW);
+        micDelay(PROGRAMMING_MODE_CLOCK_CYCLE_DELAY);
+        value = (value >> 1) & 0x7FFF;
+      }
+    }
+
     void writeCommand(unsigned char cmd) {
-      for (int i = 0; i < 6; i++) {
-        digitalWrite(PROGRAMMING_CLOCK_PIN, HIGH);
-        digitalWrite(PROGRAMMING_DATA_PIN, (cmd & 1) == 1 ? HIGH : LOW);
-        //Serial.print("Writing: "); Serial.println((cmd & 1) == 1 ? HIGH : LOW);
-        
-        delayMicroseconds(PROGRAMMING_MODE_CLOCK_CYCLE_DELAY);
-        digitalWrite(PROGRAMMING_CLOCK_PIN, LOW);
-        delayMicroseconds(PROGRAMMING_MODE_CLOCK_CYCLE_DELAY);
-
-        cmd >>= 1;
-      }
+      pushOutBits(cmd, 6);
     }
   public:
     PICProgrammer() {

class ReadTextWordControl : public Command {
  public:
    virtual bool match(const String& name) const {
      return name.startsWith("text_read");
    }
    
    virtual void execute(const String& commandString) {

      if (!programmer->inProgrammingMode()) {
        Serial.println("ERROR: Programmer not in programming mode");
      } else {
        StringSplitter splitter(commandString, ' ', 2);
        const bool numberGiven = splitter.getItemCount() > 1;
        
        int count = 1;
        if (numberGiven) {
          String parameter = splitter.getItemAtIndex(1);
          parameter.toLowerCase();
          count = hexToInt(parameter);
          if (count < 0) {
            Serial.println("ERROR: Invalid increment (must be positive!)");
          }
        }

        while (count > 0) {
          programmer->incAddress();
          count--;
        }

        if (numberGiven) {
          Serial.print("New address: ");
          Serial.println(String(programmer->getLocation(), HEX));
        }
      }
    }
    
    virtual void printHelpString() const {
      Serial.println("  inc [number]          increment write/read by number of addresses (default is 1)");
    }
};

class BurnProgramControl : public Command {
  public:
    virtual bool match(const String& name) const {
      return name.startsWith("burn");
    }
    
    virtual void execute(const String& commandString) {
