Added 'PachToFile' function