sonar violation refactored