Changed read function to support sets.