Added nil check to model. Added remaining unit tests.