Move reindex code into separate class

This depends on I5848fac3a79fc694875f5bc5ca3073d7a0190e55

Change-Id: Ib7bea664e47f38854bfc1e43b58f2c4731217261