Add options test.
Refactor code.