Stop using reference IDs and use reference names instead

I have a few more tests to fix but this is definitely ready for more eyeballs on it. Hopefully I'll be able to fix the remaining ones tomorrow.