Added model validation, updated unit tests