Code cleanup
Track object ids instead of objects themselves

in operator on objects may have unexpected side-effects, like
calling __cmp__() on objects.