Added Scala Implementation