refactor domain model, create tests for domain model