added file handling routines