Added volatile in main.c for some variables. Deleted unused vars.
Function retInString moved to protocol_handler.
Added volatile modifiers to global vars and structs