make a writer class analogous to reader in io/ and use that here?