Refactoring controller functionality...