Added the function for statistics