Add some more diagnostics
Some bugs and some doxygen