improved efficiency by using sets

duh!