Changed memory storage to set instead of array