removed closetag reference and fixed tag expansion