Added debug mode to API