tidy up client code - remove commented out segments and unused functions, tidy up formatting