added the viewmodel pattern + tests