d3 | Refactored tree to support two way binding