Added file output option.
Bug still exists.