Refactored with SOLID principles