jshint: js code validation and beautification

As discussed with Justin, this pull request includes the following changes: 

1. Ran JavaScript beautifier, as per jsbeautifier.org – this is not strictly anything to do with JSHint but makes it easier to spot invalid code. (We may want to tweak code layout further at some point – opinions vary...)

2. Added global 'use strict' to main.js and updated code to avoid errors.

3. Added JSHint options to main.js and updated code to validate.

@juberti and @marwahvikas PTAL.

I changed this for a couple of reasons: 

1. I'd prefer to explicitly return null rather than implicitly return undefined by not returning anything.

2. If  extractStatAsInt() returns undefined, we need using `rtt != null`, which appears to imply a test for null, not undefined (and will get warnings from JSHint). 

If you think we're better off sticking with undefined we could use `typeof rtt = 'undefined'`.