'Fixing' algorithm