hopefully somewhat correct file and text handling, no changes in file