temporarily backing out changes
added ability to write to output file