Major refactoring to support dashboards