switch out for loop for underscore _.each in main.js