clean up the module and fix a problem where tasks were being run multiple times.