made handling of optional end tags a little faster