with-mock-io refactoring