Refactored and added tests for Domain model