working on abstracting file IO