Improvements and optimizations to IO.