More refactoring.
Condensed code.
Moved common option code.
Moved common option code.
More refactoring.