inlined and vectorized remove_contribution