Refactored edit controller.