Make handshaker more verbose
cleaning up socket connection routine, removed redundant writes, added error handling, better naming