Working version of the model refactoring