code refactoring from sonar analysis.
Merge pull request #253 from nla/sonar-refactor

code refactoring from sonar analysis.