added a bunch of asserts into the compact_set function
minor optimization in the compact_set function (when there are no unsorted values)
minor improvement in compact_set - don't enlarge the array when not needed