passed through jshint and corrected few things (mainly formatting and removed unused variables)