Changed remaining for loops to _.each, and added some more commenting