moving legacy code into own module