Refactor into Compile module