Added code for receiving messages. Logout now crashes app for some reason.