Changed unchecked element access to use square brackets (operator[]).