Register message handlers. Not yet tested.