Improves and fixes reference token referencing.

* Removes potential DoS vector.
* Fixes collision potential caused by MD5.
* Removes span count roof.
* Fixes tag cache memory leak.