Refactoring to the models