Added a debug function and a DB dialog
Debug works now too