changes to code to find inverse of matrix