deduplicate back-tracking and ring self-replication; tests