Organising a single canvas-long code in instance mode

I’m writing a very long code for a single canvas in instance mode and it’s getting confusing, specially the draw area.
how can I organise an instance mode code in different sketches (for a single canvas) considering its drawing order ?

thank you