move message handlers to Client