refactored; add query to display exact table rows count