Refactor into a module