Using sets not lists for speedup