Made iterative element access run O(1)

Used to run O(NlogN)