Pulling in changes lost in pull req from feature/new-stats-queries