Made some changes to anonymous function.