Added formatting of final output on exit