refactored build script structure