Massive refactoring of Model class