Added error logging and comments to client source files