Changed indexing alg
Fixes after rewiev