Refactor bestfitChunk and initHeader
start findBestfitChunk