Move scope of depth() and wrap()