had to mangle code because repeats with different names can share IDs