Global refactoring: separate model from view