Fixed (#29) and (#40)

Still missing a few comments here and there, but we're in a much better state
now.

Also re. (#29) I think I've more or less cleaned out all the callbacks.