Move callback helper functions to separate module and generate them using macros
Fix import