replace old anon funcs with lambda