Refactoring view code.