Refactor dashboard_controller