Re-worked loop via jquery each