update the algorithm idea from