added count function to get total items