set:  sorted inserts, using qsort. fixed resize code

lots of other wonderful stuff.