Debug database fix - adding stacktrace tuneability and docs