Hi @savvaskef
Sorry, It is not possible for me to understand all the code you dumped above.
You say that it works, so I am a bit confused as to how I could help.
Perhaps you will need to simplify your above comment to highlight specific lines of code which are troubling you.
Thanks
E