Removal of end tags, minor cleanup