Improve domain model and add unit tests