callback refactoring