Changed read and write function to take no arguments