Moved much of the functaionlity to a BaseModel.

* This is in order to create a DictModel class.
Added more tests.