Cleanup and improvements on build scripts