Added debug logic for testing chunk generation