finish controller refactoring