added ns algo