Refactored options.
Add javadoc