First round of stats functionalities in backend.