This callback function could be refactored into its own non-anonymous function.