Refactor control_panel