made the code more DDD