added unittests for region + small cleanups
flake8 ready
Merge pull request #1178 from xliiv/feature/regions

Added unittests + small cleanups