algorithm updated