reformatting code for readability

- Word-wrapping closer to around 80 chars
- Splitting overlong comments and moving to line above code.
- Cleaning whitespace.
- Fixing a few typos in comments.
- Fixing a small typo in readme for uglify repo
- Fixing a minor logic issue for insert image