Added comments and edited code to cache inverse, not mean