minor cleanup and refactoring of the view