move free() out of critical section
"doCompact" attribute for collections
added assertion
added comments
added stub tests for functions