converting to scala, stage 1