Simplify and merge conditions for path removal in _tracePaths()