Backend changes for generalize-double

Once diagrams-lib is merged.