created a loop that sorts objects based an item type property