refactoring of Sandbox.extend