motion control left and right logic