I have no clue how ivars work in modules.  Will this end up being shared amongst threads?  If so, you may need to wrap the various modification ops in a mutex.