Some problems resolve using funtional porgramming with Scala