In progress port of orchestration code to python