updated with sets and dict