Count total records based on tables, resolves #21