added rindexing, and key management