simplify pattern match