refactored to stats.d