separating all the stats function as a separate api call