using reader/writer