Made it look a bit more like an R-package.  Currently untested.