ChangeDirection method modified