Implemented cached inverse function