Extract stats from searches
Refactor