Added capability for weighting functions