Sorry but that code appears to be all over the place.

You seem to be running subs from other subs then calling back to those subs again.