format output and add header