clean exit, further function abstraction
FileOutputFormat writeMode
typo fix