better input/output file management