# Cleaning up your flows

## Aligning nodes

The selected nodes can be aligned to the top, bottom, right or left by using the using **shift-w/a/s/d**

* **shift-w** - align top
* **shift-s** - align bottom
* **shift-a** - align left
* **shift-d** - align right

## Distribute nodes

The selected nodes can be distributed vertically or horizontally using **shift-q/e**.

* **shift-q** - distribute horizontally
* **shift-e** - distribute vertically

## Aligning arrows

You can also align on arrows, which means moving the nodes it connects to so that the line becomes level. To do this, select a node and use either **shift-w** to move the bottommost node up, or **shift-s** to move the topmost node down.

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRdFpuRAnTVYgmlCXLLou%2Fuploads%2FXTy6Kd5hfBfeGcQrS0ew%2FClipboard-20250327-194005-434.mp4?alt=media&token=7eed0dd2-3a34-41a3-8688-68c116f3efd7>" %}

## Group nodes by converting them to a function

Selected nodes can be converted to a reusable function by right clicking one of the selected nodes and clicking 'Convert to function'. The nodes will then be moved to a function (which you can give a custom name) and replaced by an instance of that function. Any arrows to and from those nodes will be automatically hooked up, and the behavior of your application stays intact.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.midio.com/midio-docs/guides/clean-up-node-graphs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
