changed movement algorithm