Refactored message dispatch in client to match that of server.