fixed saving output
fixed save and added headings