refactoring compile script