Removed template junk
Corrected row ids on output sub

Added further validation.
Fixed output sub to correctly handle sort columns, multipage tiffs by
resetting the row curser after export