Fixed bug if the number of regions less than 4
Removed old, commented code