Modified BFS, does not avoid cat