please read this tutorial on how to post code in a way that is comfortable to analyse
best regards Stefan