Replace trusted lambda block with trusted nested function