Move I/O functions to another file