working reader and writer programs