Refactor next_block to extract a _map_parents function.