Cleaning up JS

I fully understand how most people say looking at your old code gives you nightmares... going to give this project some TLC today.  This commit I just ran it through JSHint and moved some variable declarations around.