JSlint errors

Tidy up to pass JSlint. Wrap in strict mode function.