rewritten io.scala