First hash of code

All going except for the GSM comms stuff.