nit: `var media = [];`