Some controller refactoring