adding cache Inverse R script modified