Minor optimisation : use initial (sorted) list instead of immutable copy.