DRY code, extract doGetOpen and doSetOpen