Added support for the writing chunk by chunk