Refactor and generalize callbacks controller