Algorith updated according new spec