Adapt code according sonar issues. Part2