Removing a debug echo.
Adding a unit test and some related bug fixes.