Use a closure to prevent name leaks