converted main class (RemoteEntities) to Scala.