Changed to a DFS approach.

Discovered a test case where BFS does not work.