truned script into R package