incorporated a few unit tests -- run automatically with R CMD CHECK