Working on more robust file functions.