JSHint updates

There are couple remaining JSHint suggestions, mostly about not making functions in a loop.