better debugging support in library
mostly for fun, but perhaps a start