shared_ptr -> unique_ptr and trimming of levels