add tags and end extensions