Implemented CQRS pattern, some refactoring