refactored build scripts