This algorithm now works!