changed pattern matching strategy