First part of the controller refactoring