minor refactoring, and logic in place for deopenize