added logic to create cache object
added logic to retrieve/calculate the inverse
added general comment