Scala code