Refactoring, and adding test for updateView