Tag index

Just starting on this, not for merging yet, but feedback welcome.
Are we in trouble if someone pulls the plug halfway through this function?