Added debug mode flag