added file creation and checking