some refactoring for be better testable
added refesh test
added openOptions test