refactor code according sonar