Implemented ViewModel for the MainView. Did some code clean-up. Added comments.