small refactor for weighted pairing log5