adding pattern matching