STY: Clearer algorithm