use correct _.each ordering, and add a test