Updated for Scala