Added reference passing for fopen -> which allows for renaming of files