listview.js: really messy code