cleaned up utils.do_flow and used it more