modified selectQuery and validateClause