prepared for CRAN submission