Model unit tests

Added a bunch of unit tests.