Use Arc instead of spinlock destructor, try BTreeSet, add sanity checks