added reindex function