Started working on heap factories.
Added more tests of factories.