added totalcount and removing empty rows