Minor refactoring for Controller.