Moved more common option code.
Added more tests for common behavior.