refactoring the view