Some refactoring

Some refactorings of the controllers and application services.