Removes unused variables
Various indentation
Fixes variable redeclarations
Uses Array.prototype.foreach for stricter scoping
Strict comparison operators with 0