Add pattern matching