Factor out all file reading and writing into CommandRunner