added functions to R/ in prep for pkg building