added support for wrap and wrapnext tags, also some other adjustments