replace anon class with lambda