Refactored typecheck patterns