Replace depth count with loop detector

Removing depth and replacing it with loop detected, which was described as option b) in Pull Request #33.