Add normalization and deterministic tie-breaking logic
Add normalization and deterministic tie-breaking logic