Added derivation depths. This fixes some problems with retraction when cyclic facts are derived.