new code to do 2D regions