refactoring the db view report