}else{
if it works for you, whatever, but I can't begin to tell what brackets go with what blocks of code in this entire program. This is a touchy subject, though.
I prefer all variables up front, not 'on demand' eg lines 78 & 90. Also personal preferences on that, no big deal.
you may be mixing 2 languages (variable final, unless that word is shared in both languages?)