anonymous function and code review