update to pattern matching