Changed StatsActivity and reorganized some code