Fixing unit tests so they pass, and replacing some matrix inversions with \ operators