I would rather leave this method as it is on current master https://github.com/mozilla-b2g/gaia/blob/master/apps/homescreen/everything.me/modules/Apps/Apps.js#L334

I would want to revise this in the future - it works, but isn't coded elegantly.