refactor in the module to use callbacks