Refactor extractOption.