Overall, this kind of scripting looks so verbose and error prone to me. Investigate some ways such as using common script file to make it more manageable. If this is temporary before moving to a better approach, please open an issue for it.