Fix Learner message handler.
Rounds and cleanup.
Merge branch `rewrite` into `master`.