Build script cleanup and improvements.