Worked on invsimp R script