Refactoring: extract callback