Refactoring and cleanups to orchestration scripts

Please read the docs to understand the design intent.