Modified Scala example