Added support for chunking (see #5)