refactoring dashboard controller