refactor Option code