A bunch more unit tests.
Changed the trace implementation to hide the presence of a global trace object.