refactor CreateFlow