refactors statistics service