Took Scott's suggestion to combine the functions.  Also updated tests.