Scala complex api