Changing client side messages to be in JSON format

Messages are now sent and received in JSON on the client as well.

Also cleaned up some unused code.