Refactor ListView creation code