added configurable chunk size