Added debug mode for printing logs