Implemented all the stats functions