Added test classes for the result package.  Also fixed bugs uncovered by the tests.