changed table.size to table.count