Make the build script smarter