The result is a function in a new cell. Any variables needed by the cell are parameters, and any variables defined are return values. You can now cut this down.