Add javadoc
Fix [SonarQube] if statements should be collapsed