TODO: closure-ref handling