Refactor ClosureNode with a nicer API