Refactoring of callbacks