Refactored build process