refactoring to models and updating services