Comments and Clean

added function headers and cleaned up code.
Function added to client.cpp