Refactoring; extracted the create and checkout branch into a method