eliminate last jshint errors/warnings

This was done by (a) using prototypes everywhere, (b) not constructing
anonymous functions inside for loops.