Do not rely on outdated _index
Do not rely on outdated _index

Instead, calculate the index with indexOf - should be no problem since we
only do this once.

Also made some cleanups to remove side effects and reduce array lookups.

PetrDlouhy/openlayers,Gnafu/openlayers,avinet/openlayers,georchestra/openlayers,owenmead/openlayers,ahocevar/ol2,PetrDlouhy/openlayers,dracic/openlayers,shevawen/openlayers,PublicStuff/openlayers,avinet/openlayers,colllin/openlayers,avinet/openlayers,pgiraud/openlayers,wet-boew/openlayers,PetrDlouhy/openlayers,openlayers/ol2,pgiraud/openlayers,owenmead/openlayers,altamiracorp/openlayers,v5analytics/openlayers,sbrunner/openlayers,pvalsecc/openlayers,openlayers/ol2,wet-boew/openlayers,elbakai/openlayers,georchestra/openlayers,PublicStuff/openlayers,kartverket/openlayers,shevawen/openlayers,avinet/openlayers,sanak/ol2,shevawen/openlayers,altamiracorp/openlayers,sbrunner/openlayers,pgiraud/openlayers,openlayers/ol2,elbakai/openlayers,dracic/openlayers,PublicStuff/openlayers,wet-boew/openlayers,adh1365/openlayers,v5analytics/openlayers,sbrunner/openlayers,Gnafu/openlayers,georchestra/openlayers,pgiraud/openlayers,Gnafu/openlayers,elbakai/openlayers,sanak/ol2,altamiracorp/openlayers,sanak/ol2,owenmead/openlayers,v5analytics/openlayers,colllin/openlayers,sbrunner/openlayers,pvalsecc/openlayers,ahocevar/ol2,altamiracorp/openlayers,dracic/openlayers,sanak/ol2,kartverket/openlayers,v5analytics/openlayers,kartverket/openlayers,adh1365/openlayers,kartverket/openlayers,shevawen/openlayers,wet-boew/openlayers,owenmead/openlayers,openlayers/ol2,PetrDlouhy/openlayers,adh1365/openlayers,dracic/openlayers,Gnafu/openlayers,colllin/openlayers,PublicStuff/openlayers,pvalsecc/openlayers,adh1365/openlayers,ahocevar/ol2,pvalsecc/openlayers,colllin/openlayers,elbakai/openlayers