preliminary Scala conversion done