improves tbb implementation with lambda functions