View model refactoring. Introduced StateViewModel.