Replaced anon function with class function