Move IO related things to io.go