Scala common code