Nicer implementation of query builder and query constraints.