Beautified code.

- Added semicolons at the end of the statements
- Removed global variable definitions (Using a variable without defining it with var puts it into the global namespace aka window)
- Removed duplicate variable definition.
I'm pretty sure these are needed.