Implementing calculations of stats