Final Code for additem  and index