[refactor] refactoring of the code based on sonar suggestions