refactor around buffering chunk