Relatively large refactoring of callback methods, cleaned up some code and made them more consistent.