removed lambda statement and small internal optimizations