add IntSet.h and some refactoring/cleanup