Hi,
It is really hard to help you given that most of what happens in this big function is using other custom functions from your code.
You would need to reduce the example to only contain a small subset of things so that you can share them here and it is easy for us to read it.