We filter out already visited states when adding them to the work list. We also don't sort the work list as we're already generating it in a sorted (by cost) order.
Quite slow takes ~11 mins to run.