added a anonymous function expression to clean up