One of your main issues in that block of code is redundancy. See how you're executing almost identical code time and time again? That really should be handled by a function/procedure. Also,...