Cherry-picked AHelper's first round of I/O additions.