Fixed multiple issues with deleting refrences to removed documents. Also did the same for resettting the index. closes #8