Move code outside to buffer-pack.