removed redundant 2x2 det calculation from cofactor function