Fixes algorithm