pass readers and writers by ref