# Hierarchical Operations: Flatten Instances, Make Cell From Selection, Move Up In Hierarchy

Klayout provides several operations that move shapes or instances up and down in hierarchy. All these operations are accessible through the "Edit" menu in the "Selection" sub-menu.

- Flatten instances: Replace the selected instances by the contents of the instantiated cell. KLayout will ask, if all levels or just the first level of the cell should be expanded. If all levels are expanded, the cell will be resolved into a set of shapes in the current cell's hierarchy.
- Move up in hierarchy: Applies only to selections inside child cells of the current cell (thus does not make sense if 'top level only' selection mode is active). The selected shapes and instances are brought up to the current cell's level and removed from the original cell.
  A non-destructive way of moving a shape up in the hierarchy is to copy and paste the shape. This does an explicit flattening of the shapes selected when inserting them.
  Hint: the current implementation removes the selected object from it's original cell. Since it only creates new copies for the selected instances, the object ist lost for all other instances of the cell. This may create undesired side effects and it is likely that this behaviour will change in future implementations.
- Make cell from selection: Removes the currently selected objects and places them into a new cell whose name can be specified.