Global models refactor. Some unittests.