some queries not needed before loop