adding tests for result analysis code. merging shared code by making one class a subclass. bug fixes.