diff --git a/server/djrandom/frontend/static/player.js b/server/djrandom/frontend/static/player.js
index bb4e4bcb9ca19ec0ae0b0801b107f4dcc2c14266..ee9a51740f5ab8d3310ef7642deaa646ef4bae22 100644
--- a/server/djrandom/frontend/static/player.js
+++ b/server/djrandom/frontend/static/player.js
@@ -101,11 +101,12 @@ djr.Playlist = function(uuid) {
 
 // Return an array with all songs, in order.
 djr.Playlist.prototype.allSongs = function() {
-  var songs = [];
-  $.each(this.chunks, function(idx, chunk_id) {
-    $.each(this.chunk_map[chunk_id].songs, function(idx2, song) {
-      songs.push(song);
-    })});
+  var songs = [], i, j;
+  for (i = 0; i < this.chunks.length; i++) {
+    for (j = 0; j < this.chunk_map[this.chunks[chunk_id]].songs.length; j++) {
+      songs.push(this.chunk_map[this.chunks[chunk_id]].songs[j]);
+    }
+  }
   return songs;
 };