refactoring and review SRP principle