moved $in_anchor from global to do_anchors() as a local variable