Replace depth count with loop detector
Merge pull request #36 from daivanov/master

Replace depth count with loop detector