Split into separate files
Tidy up namespace declarations
Make load-trace optional
Start adding some tests