Refactoring build script