Added required checks in query builder