Deeply nested routines make for code that is difficult to navigate and understand. While nested routines can be helpful for small units of work specific to a particular routine, their ambiguous syntax and non-linear control flow make them confusing when containing large amounts of functionality.
Extract the nested routines out into one or more top-level routines:
procedure DoThing;
procedure DoSubThing;
procedure DoSubSubThing;
begin
// ...
end;
begin
// ...
end;
begin
// ...
end;
procedure DoSubThing;
procedure DoSubSubThing;
begin
// ...
end;
begin
// ...
end;
procedure DoThing;
begin
// ...
end;