Add conditional indexing

Also now rebuilds the current_values on each index run, which ensures
current values that are being used are stored.