Efficiency and structural changes; methods to support mongodb use
Changes to adapt to using mongodb instead of internal arrays and pickles