refactored Count and added stdev field