rewrite as a dataflow. simplify tool