Refactoring to mvvm