service and controller refactoring