Refactoring with SOLID principles