Added "use strict"; and minor changes and fixes.

  * Enabled strict mode.
  * Minor fixes.
  * Named all anonymous functions to improve trace readability.