Initial jshint fixes
Code clean-up

- Convert function declarations to expressions
- Move some vars to top
Major code clean-up

Attempting to adopt at least something akin to a style:
- 2 spaces/indent
- Closing tags nicely aligned with starting indent level
- Spacing in object naming
- Only chain commands on a single line if they finish on a single line,
  otherwise put each chained item on its own line
- All line 79 chars or less