[refactoring] refactoring code based on suggestion from SONAR