refactor the turn left and turn right function