simplify pattern matching