addid loop code