Added debug mode for file io