refactoring to fitt for sonar