Require cleanup

Replace underscore with lodash, or native forEach/map.

Also remove many unused require statements in the process.