Better change direction logic