Add html ids and fix rating selection when sorting