changed duplicate query with values_list/count to single query