split build script into 2 parts