Added some command-line options.
Refactoring.