Added in chunking calculation routines to keep self-contained