Implemented matrix invert