improved io
calls distance.scala