use a and b to change the direction