LGTM. In the future it'd be nice to maybe split out piece/bit_piece handling into their own self-contained functions, and maybe share more code between them. But landing this narrow fix now sounds good.