rearranging dataflow