Adding code for inverse.