Update to algorithm