Updated pattern matching