Refined do_build.sh