Previously we modelled the top row as a connected series of nodes and allowed them to connect to each other directly. This ignored the rule that you have to move directly to the place you want on the top row and then back out of it.
However, that was fine as the lowest cost would imply that. But it does slow down and give more states to consider.
Instead, model the nodes on the top row as being directly connected to the nodes in the second row. Add some rules about when you can move from one to the other and use those.
This reduces the number of states we have to consider in total. And hopefully speeds up the process.