Refactoring the DB view template