flatten if-chains into smaller chains, chunking reduces the overhead of flattening them out entirely