Refactor ensure wrapper method.