Refactored perspective detection