Ported main object to Scala.