works now

uses fstream