Remove javascript closure.
Create block to add nodes.
Add logic to add nodes from block.