Changed function to anonymous function

Converted function into anonymous function.