Merge "Refactors build script for Apex"