Modified code to use rest-reader and rest-writer for reads and writes