Refactor createFlow to use steps and fail branch