Loop around when reaching the limit of going up or down