Reworked indexes as they weren't really threadsafe