This is slow and I'm not sure why. I should probably have used my Dijkstra utility, but I'm not convinced it's working right now.