code for the second try on CRAN