simplified serial comms, removed broken part; added serial command receiving to main function, tidied output, moved components of main void loop into other functions