Don't do for sensor from 1 to length(sensor_list) do unless sensor_list(sensor)(1) = odometer or Instead do for sensor in sensor_list do ======================================================================= Replace warnings with mishaps. replace consword('left') with "left" ,etc. ======================================================================= Much tidying up in create_vehicle