Started refactoring deploy into two parts