Fixing bug after review with JG.  Added tests.