refactor extractRegions