Updated to output chunks correctly