* added dynamic resizing to SharedCollection
* tweaked thread synchronization code to make more robust
* refactored SharedCollection