Update algorithm from develop.