Finished basic region generation algorithm

For issue #9