That's a ton of code to ask strangers on the internet to debug for you, for free, in their spare time. If you want better help faster, I suggest creating an SSCCE that demonstrates your problem in as...