Minor IO refactoring