you can set this directly to $ids, no need to set it first to empty.