Simplify function contains()