Refactor the service