Refactoring; Finding cycles without traversing the entire state graph.