Finished counting stats part of the code