externalized all the queries