Code cleanup and add a test for anchor="as-char".