My Scala codes