added file reading and writing features