added chunk size argument