Clean-up and improve build script