cleaned up the code a bit, and now sends some of the anchors directly to references