Working version.  Removed test code.