Fixed some bugs but still not working in the cubic case.
Fixed several bugs. Now it computes for the cubic as well.