Fold _invperm back into invperm; add tests