a simpler file reader and writer wrapper