Cleaned up websocket client code and better logging.