Added debug flag to the API for plain text output