refactoring of callbacks and services