Rewrite playlist.js and some other tweaks