added getinverse function