Add patches for partial order encoding

These are experimental changes only included here to make it
possible to apply them on the drk machines.