passing the maxSteps and params.count state around seems funny, I wonder if we could encapsulate the flow state differently, either in an object/closure that's passed around, or by moving to a state pattern, where each state knows how to get to its neighbors, but there's no central thing keeping count.