Added condtional check to set the item type