Refactoring some more view code