Finished up simple inv functions. Untested.