Bunch of Sonar fixes: magic numbers, commented lines of code,
collapsable if stmts, etc.