Use a higher-order function instead of verbose function wrapping.