Cleaned up sets.js a bit, and fixed relevant tests.