logfile now gets written in sorted order (not in sorted chunks as before)
whitespace cleanup