Refactored build script to fit new structure