Refactored Object model. Added some unit tests.