using sets instead of arrays