Pure Scala, bug fixes