Optimize lambda captures