small change to BFS that prevents adding loops to the queue LOCALLY. I suspect that the while loop keeps checking the same path and adding them back over and over again.