Refactoring dashboard metrics with updated API code