Fixes. Added some testing code.