Fix learner behavior.

Update accept counts properly.
Fixing joins.
Function signatures.
Cleanup diary.
Merge branch `rewrite` into `master`.