make use of iterators more

fix bizarre CRLF inconsistencies
augment the template with some statistics