split up dataflow phases into functions