updated deleteLoop