Region division. Still contains some bugs