Refactored the query report