this function body is huge, break it up in several (private) subfunctions: `_squash_X`, `_squash_Y`?