Fixed up the protocol. Needs checking. Closes #71
To be loaded onto a microcontroller. Unnecessary code will be removed
later.