reworked in prep for cran upload.