updated the anonymous function snippet