Refactored path detection to handle more cases