Made indexes work.

Still got some work to do before mergin