Maybe better to abstract the function so it's cleaner to pass the named function here. Also, I'd try to keep anonymous functions to a minimum to ease debugging.