Initial pull from Github.  Added a few helpers as-is.