Refactor type weighting to helper function.