Fix formatting and remove unnecessary code.
Capture all exceptions in test framework.