revised code for home stats and dashboard stats