Refactor input validation logic to use .is_a?() method