moved callback code to module