improve the comments, implements SetInverse and makes minor changes to output