put the running module code into a seperate function