Port to Scala
Decrease the level of concurrency