Extract hook from lambda to function.