moving algorithm updated