Moving stuff from function to module.