Scala-based Tree Data Structure