Code refactoring for the View