Improved recursion detection. Refactored method names.