some routines for doing set calulations