Debugging logic for detecting paths.