Allow extraFields to be a function instead of just a map