better input file handling