Added a check to see if the item is empty, and deleted unnecessary logs