Enable nice debugging output in debug mode
Use more robust detection of debug mode
Fix searches