Adjustments to build.sh script so that it runs on slower environments as well.