add invertm

PR from its own branch(instead of master) this time