unit tests for model/view integration, small refactoring
added comments