update scala and scalatest. refactor a bit.