Added IOInterface and refactoring to use it.