Optimize build script