update algorithm
able to demo