Some much needed linting of the application.js

Some whitespace ans syntax changes, indentation, variable definition,
removed some unused variables.