implemented basice file I/O.