Added test result recording and displaying.
Numerous code improvements and refactoring.