Code cleanups and refactoring.
Bumped version to 3.9.0.
Help messages improved.
Minor bug fix.