reorganize code (in preparation for handling NULL callbacks)
further work towards handling NULL callbacks
handle NULL callbacks; wordwrap at 76 chars