Tag index

Just starting on this, not for merging yet, but feedback welcome.
This locking here doesn't look like it does much. Why are you locking while pulling `name` off `db`?