Updated Lab2.scala