Added: Functions to read from and write to file.