Made the new file function work