formalised the query