Make setting interaction IDs more robust

Currently, if there are duplicates in the index, there will be duplicate interaction IDs, which causes all sorts of funky behaviors.