Refactored more coded in dashboard