Simplifying where clauses