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.