Reimplement I/O library. No modifications yet.