Added reindex function