Refactored build scripts