tried to implement inverse