added constructqueries
inferDirection Added