Do a bit of cleanup in __init__ (add explanatory comments, move side-effect functions to a utility module).