Refactoring the backend service to be a proper class.