Started refactoring environment manager script