{Bed[K_, \[Omega]_] := Module[{t, r, XingsByArmpits, bends, faces, p, A, is}, 
     t = 1 - \[Omega]; r = t + Conjugate[t]; XingsByArmpits = 
       List @@ PD[K] /. x:X[i_, j_, k_, l_] :> If[PositiveQ[x], 
          SubPlus[X][-i, j, k, -l], SubMinus[X][-j, k, l, -i]]; 
      bends = Times @@ XingsByArmpits /. _[X][a_, b_, c_, d_] :> 
         Subscript[p, a, -d]*Subscript[p, b, -a]*Subscript[p, c, -b]*
          Subscript[p, d, -c]; faces = bends //. 
        Subscript[p, x__, y_]*Subscript[p, y_, z__] :> Subscript[p, x, y, z]; 
      A = Table[0, Length[faces], Length[faces]]; 
      Do[is = (Position[faces, #1][[1,1]] & ) /@ List @@ x; 
        A[[is,is]] += If[Head[x] === SubPlus[X], 
          {{-r, -t, 2*t, Conjugate[t]}, {-Conjugate[t], 0, Conjugate[t], 0}, 
           {2*Conjugate[t], t, -r, -Conjugate[t]}, {t, 0, -t, 0}}, 
          {{r, -t, -2*Conjugate[t], Conjugate[t]}, {-Conjugate[t], 0, 
            Conjugate[t], 0}, {-2*t, t, r, -Conjugate[t]}, {t, 0, -t, 0}}], 
       {x, XingsByArmpits}]; MatrixSignature[A]], 
 Kas[K_, \[Omega]_] := Module[{u, v, XingsByArmpits, bends, faces, p, A, is}, 
     u = Re[\[Omega]^(1/2)]; v = Re[\[Omega]]; XingsByArmpits = 
       List @@ PD[K] /. x:X[i_, j_, k_, l_] :> If[PositiveQ[x], 
          SubPlus[X][-i, j, k, -l], SubMinus[X][-j, k, l, -i]]; 
      bends = Times @@ XingsByArmpits /. _[X][a_, b_, c_, d_] :> 
         Subscript[p, a, -d]*Subscript[p, b, -a]*Subscript[p, c, -b]*
          Subscript[p, d, -c]; faces = bends //. 
        Subscript[p, x__, y_]*Subscript[p, y_, z__] :> Subscript[p, x, y, z]; 
      A = Table[0, Length[faces], Length[faces]]; 
      Do[is = (Position[faces, #1][[1,1]] & ) /@ List @@ x; 
        A[[is,is]] += If[Head[x] === SubPlus[X], {{v, u, 1, u}, {u, 1, u, 1}, 
           {1, u, v, u}, {u, 1, u, 1}}, -{{v, u, 1, u}, {u, 1, u, 1}, 
            {1, u, v, u}, {u, 1, u, 1}}], {x, XingsByArmpits}]; 
      (MatrixSignature[A] - Writhe[K])/2]}
