Refactored input type determination and verification.