Makes ESLint happy and fixes #165. Changes:

- Making brace style consistently follow Stroustrup
- Cleaning up some small JSDoc blips
- Moving a function declaration to outside a loop
- A few minor things like semicolons, trailing commas and spaces, and empty blocks