adds pattern matching