Ensure closure with inner functions