updated for submission to CRAN