refactoring model, convert to MVVM