Further migration to Scala