refactored main viewmodel