update Algorithm