refactor dashboard controller