Recursive and non-recursive tree implementation with help of coffeescript