misc reorg in viewModel.js, divided method into parts