Add comments to server code.
Cleaned client side code and added comments.