moved most of code to ViewModel