refactor callback calling