Fuctions for cached inversion.