added file handling functions