Tag index

Just starting on this, not for merging yet, but feedback welcome.
ah yes, it actually needs the read lock for the entire time.