refactored Viewmodel