Lab3.scala fixed