added missing jquery parameter and changed $.each with _.each