refactor logic module into a package