add pattern matching