Functional Refactoring in Scala material update