build script refactoring