Improves error reporting
--debug option sets logging level to DEBUG