m50

update algorithm