Added time parameter to read and write functions