refactored the model into a service