added a bunch of scala
while loops