Refactor some I/O interfaces.