condense logic in regions_transformer