converting everything to Scala.  Adding backend main.