     if ( (size = Midi.RecvData(outBuf)) > 0 ) {
       // Send data to parser
       parseMIDItoAppleBle(size, outBuf);
-
     }
   } while (size > 0);
 
  uint32_t err_code = NRF_SUCCESS;
-
 }
 
 /*******************************************************************************
  * Convert MIDI BLE to MIDI USB
- * !!!! THIS NEEDS TO BE REWRITTEN FROM SCRATCH !!!!
- * 
  *******************************************************************************/
 void parseBLEtoMIDI(uint8_t *dataptr, uint16_t bytesRead)
 {
-  
   uint8_t outBuffer[128];
   uint8_t outPtr = 0;
   uint8_t singByte; /* single byte from message */


/*
 *   Copyright (c) 2014 Matthias Frick, All rights reserved.
 *

  // Remove header byte
   memcpy(bufMidi, dataptr+1, bytesRead-1);
   startStamp = bufMidi[0];

  for (int i = 0; i < bytesRead-1; i++) {
    switch (prsState)
    {
      case MIDI:
        if (i%4 != 0)
	      {
          sprintf(debugBuf, "MIDI: %02X", bufMidi[i]);
          Serial.print(debugBuf);
          outBuf[(i%4)] = bufMidi[i];
        }
        else
	      {
          Serial.print(" - ");
          Midi.SendData(outBuf,2);
          memset(outBuf, 0, sizeof(outBuf));
        }
        if ( i == (bytesRead-2))
	      {
	        prsState = STRT;
	      }
        break;
      case RUN:
	      if (i < 4 && i%4 != 0)
		    {
	       	outBuf[(i%4)] = bufMidi[i];
	        if (i%4 == 3)
          {
            Midi.SendData(outBuf,3);
          }
	      }
	      else if (i%2 == 0)
	      {
	        outBuf[0] = midStat;
	        outBuf[1] = bufMidi[i];
	        outBuf[2] = bufMidi[i+1];
	        Midi.SendData(outBuf,3);
	      }
	      if ( i == (bytesRead-2))
	      {
	        prsState = STRT;
	      }
        break;

      case SYSEX:
        if (bufMidi[i] == 0xF7) // End reached, move pointer back and overwrite timestamp with SysEx End
        {
          outBufMidi[outBufMidPtr] = bufMidi[i];
          Midi.SendSysEx(outBufMidi, outBufMidPtr+1, 0);
          prsState = STRT;
          outBufMidPtr = 0;
        }
        else
	      {
          outBufMidi[outBufMidPtr] = bufMidi[i];
          outBufMidPtr++;
        }
        break;
      case STRT:
      default:
        if (bufMidi[i+1] == 0xF0) // looking 1 byte ahead to skip timestamp
        {
          memset(&outBufMidi[0], 0, sizeof(outBufMidi)); // Empty SysEx Buffer
          outBufMidPtr = 0;
          prsState = SYSEX;
        }
        else
        {
          if ((bytesRead-1) > 4)
          {
            if (bufMidi[4] < 127)
            {
              Serial.println(bufMidi[4]);
              prsState = RUN; // Running Events
              midStat = bufMidi[i+1]; // Save MIDI Status msg
            }
          }
          if (prsState != RUN)
          {
            prsState = MIDI;
          }
        }
        startStamp = bufMidi[i];
        break;
    }
  }
}

/*******************************************************************************
 * Convert MIDI Data to MIDI-BLE Packets
 *******************************************************************************/
void parseMIDItoAppleBle(int size, byte outBuf[3])
{
  char time[2];
  char buf[20];
  unsigned long timer = 0;
  int lastPos;
  timer = millis();
  uint16_t blueMidiTime = 0;
  blueMidiTime = 32768 + (timer % 16383);

