Optimized code structure: The closure is moved to the outside of the goto