refactoring medics_controller.rb