Wouldn't g.firstOnscreen[i] be a better starting guess in this case?