Implemented depth-limited breadth-first algorithm