Fix quality flaws:
  - remove unused import
  - merge if statements
  - small code reformatting