Final Changes

Finalized the needed changes for caching inverse matrix