refactored callbacks example and added comments