Implemented more logic, changed some messages in the protocol