Refactor to MVVM