added code to include selects to the query