Robustness in sorting

The whole transformation shouldn't be affected by errors in the sorting process.

Edited by Michelle Weidling