reworked queries to use stats